No Error when failing to add a Plugin into Editor

I am working on implementing several plugins for BabylonJS Editor v4.1.0. However, sometimes, it fails to add the Plugin into the Editor without any errors or warnings. It doesn’t solve by restarting the Editor or running location.reload() in the console. It happens in my teammates side as well. Does anyone hit this blocker before? Any insights about it? Thank you!

Hi @ZzMarmot i just reproduced this issue and I’m coming with a fix!
Do you confirm that this issue appears when you try to install a plugin from NPM?

1 Like

I didn’t publish the package into the NPM remotely. This issue happened when I added package from local environment. One of my teammates hit the same issue as me but the other one was able to add the same package which made me confused.

I doubt the problem is the same as the one I have
Focusing the preferences window, when you press CTRL+ALT+i, the devtools of electron appear. Do you have some logs to share in the console?

These are the logs but not as a warning or error. It looks the babylonjs-loader is not imported successfully but we definitely need it in our code to load gltf.

DevTools failed to load SourceMap: Could not parse content for file:///Applications/BabylonJS Editor.app/Contents/Resources/app.asar/node_modules/babylonjs-loaders/babylonjs.loaders.js.map: Unexpected end of JSON input
DevTools failed to load SourceMap: Could not parse content for file:///Applications/BabylonJS Editor.app/Contents/Resources/app.asar/build/src/index.js.map: Unexpected end of JSON input
DevTools failed to load SourceMap: Could not parse content for file:///Applications/BabylonJS Editor.app/Contents/Resources/app.asar/build/src/renderer/editor/tools/plugin.js.map: Unexpected end of JSON input
DevTools failed to load SourceMap: Could not parse content for file:///Applications/BabylonJS Editor.app/Contents/Resources/app.asar/build/src/renderer/editor/components/inspectors/abstract-inspector-legacy.js.map: Unexpected end of JSON input

Can you try to add the plugin while having the devtools opened? I’m afraid that opening devtools after did not collect the errors if there are

We are now using "babylonjs-loaders": "4.2.1",

I can confirm that when I successfully added another plugin, it doesn’t have the first log info about babylon-loader but it also had the other three log info.

Hey @julien-moreau
Now I can successfully add the plugin into Editor in Windows Editor but still failed to add the same one into MacOS Editor. Still no useful log info. Is this something you saw before? I tried to reinstall the Editor multiple times but it didn’t solve the issue.

Now I can add the plugin to the Mac OS after a bunch of revert commit and checkout. I didn’t know the real reason of the failure before. Some of my folks can always add the plugin successfully but some of us cannot which is very odd.

Hi @ZzMarmot !
I have tried to catch some bugs on plugins but without success :frowning:

In your plugin, do you require something you have installed in global ? I mean require("something_global") ?

Would be useful if you can share your plugin with me so I can try to debug

@julien-moreau Thanks for your reply. Unfortunately, I cannot share the plugin before launching publicly. I do have require(“xxx”) in the plugin to do some postinstall work. I can also use import but I think I have to add "type": "module" into the package.json. Will this break the plugin integration?

Hi @ZzMarmot, you should keep using CommonJS modules and “main” key in package.json
If you import global packages, I’ll have to use fix-path in order to add global node_modules locations. This is mandatory because applications launched from Finder in macOS have a limited env configuration.