Babylon_lib not defined when loading inspector

I get this error when calling
import('@babylonjs/inspector').then(() => this.babylonScene.debugLayer.show({ embedMode: true, initialTab: 2 }));

I hadn’t used this in a long time, but it used to work fine before. (Same error when I use a normal import at the top.)
These are my packages:

@babylonjs/core: 7.13.1
@babylonjs/inspector: 7.13.1

I tried adding @babylonjs/loaders as well

From @RaananW 's babylonjs es6 starter:

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

I’ve just tried it and it works.

let me clarify

this gives the exact same error: import { Inspector } from '@babylonjs/inspector';

even when not calling

Inspector.Show(this.babylonScene, { handleResize: true, initialTab: 2 });

I cannot find anything about babylon_lib. What is it and how could it be missing?

Do you import the debugLayer too?

import '@babylonjs/core/Debug/debugLayer'
import '@babylonjs/inspector'

// show
await scene.debugLayer.show({ embedMode: true, overlay: true })

// hide
await this.scene.debugLayer.hide()

You can leave out the await keywords or replace with void if you don’t want to access the debugLayer programatically just right after you created it.

1 Like

quite odd TBH. Could you share a project reproduction? I will be happy to dig in the code.

I figured it out… I had a webpack DLL cache in place that I completely forgot about.
It seems like that doesn’t work anymore with Inspector, but I can live with that.

I’m very sorry about the unwarranted post, but thanks!

1 Like