Can't invoke inspector without CDN

After upgrading from 5.0.0-beta.4 to 5.0.0-rc.7, I can’t invoke inspector without using CDN anymore. The code in question:

        void Promise.all([
            import('@babylonjs/core/Debug/debugLayer'),
            import('@babylonjs/inspector')
        ]).then(_values => scene.debugLayer.show({
            handleResize: true,
            overlay: true,
            globalRoot: document.getElementById('#root') || undefined
        }));

This works on 5.0.0-beta.4, loading local inspector bundle, in 5.0.0-rc.7 it tries loading the bundle from CDN (but fails, which is an another problem).

@RaananW: tagging you since I assume this has something to do with your changes to the build system, as there are no visible relevant code changes between the versions.

hmmm. I will look into that as soon as I can! seems odd, as the code didn’t change. Can I ask what bundler are you using so I can reproduce this locally?

We are currently on Vite, so it’s esbuild in dev. Have to retest in built state (which would be rollup).

Confirming that I’m seeing similar issue when trying to use inspector. Something changed after 5.0.0-rc.4. I believe it’s related to handling around @babylonjs/core/Legacy/legacy, but not yet positive. It appears that local ES6 version of the inspector is not being setup.

Yep, it’s the legacy support. Working on a fix now, will come vry soon.

Thanks for notifying me!

rc.11 should be working as expected. please let me know if it doesn’t! :slight_smile:

Seems not to be working yet. Different error now, related to the inspector.

debugLayer.ts:266 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'IsVisible')
    at DebugLayer2.isVisible (debugLayer.ts:266:65)
    at DebugLayer2._createInspector (debugLayer.ts:201:18)
    at debugLayer.ts:304:22

Same error if importing sync (way I usually do it) or async (how @rassie did it). Here’s a codesandbox, if it helps:

can you try something for me? I can’t edit this, I am just wondering if that might be the issue.
Could you run “(window as any).INSPECTOR = undefined”" right after importing the inspector?

If that works I will push a fix that will be available in the next rc (12)

Yes, this works, at least in my case.

That works for me as well. CodeSandbox edited to show it:

Fwiw, you can edit the codesandbox by 1st clicking “fork” in the type right. You’ll have to sign in though, so maybe not worth it.

Yep, I just prefer working locally :slight_smile:

A fix was already submitted, rc.12 will include it.

1 Like

Hi @rassie just checking in if you were able to update to the latest version and if that solved your issue

Yes, in the meantime it’s working. I’m not sure if it was a rc.12, but 5.0.0 works fine. Thank you!

2 Likes