GUI import requires gui-editor?

Hi,

Using:
@babylonjs/addons”: “^9.1.0”,
@babylonjs/core”: “^9.1.0”,
@babylonjs/gui”: “^9.1.0”,
@babylonjs/loaders”: “^9.1.0”,
@babylonjs/materials”: “^9.1.0”,

Dev:
@babylonjs/inspector”: “^9.1.0”,
@babylonjs/loaders”: “^9.1.0”,

when I switched to 9.1 I get this error:

[ERROR] Could not resolve “@babylonjs/gui-editor/guiEditor.js”

node_modules/@babylonjs/inspector/lib/index-BCbXjPTn.js:19849:51:
  19849 │                 const { GUIEditor } = await import('@babylonjs/gui-editor/guiEditor.js');
        ╵                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path “@babylonjs/gui-editor/guiEditor.js” as external to exclude it from the
bundle, which will remove this error and leave the unresolved path in the bundle. You can also add
“.catch()” here to handle this failure at run-time instead of bundle-time.

I’m not using the gui editor in any way. I did install it as a dev dependency to see it that would fix it but no luck…

1 Like

This sounds strange, let me add @ryantrem

1 Like

Yes, the es6 package uses the @babylonjs/gui-editor, which enables tree shaking and makes it easy to host everything you need on your own server. Inspector v1 just unconditionally pulled gui editor from the Babylon CDN as umd.

Note that for other editors (e.g. NME, etc.), they are still being pulled as UMD from the CDN, but this is due to a bundling issue, so it will change in the near future!

I see also though that there was a bundling bug that was addressed in this PR: Fix inspector gui-editor import rewrite mapping by amirt01 · Pull Request #18230 · BabylonJS/Babylon.js · GitHub

I assume this must be you @riven04? If so, thanks! :slight_smile:

1 Like

Got it! The PR isn’t mine, but grateful its merged. I’ll test when it’s released and report back!