Issue in Inspector V2 cdn

Hi everybody,

I’m trying to use the cdn support for inspector V2 (https://cdn.babylonjs.com/inspector/babylon.inspector-v2.bundle.js) and here’s an issue when I want to show the inspector with scene.debugLayer.show({embedMode: true});

Here’s the error in the console :

It’s perfectly working with the playground. I don’t use React so I assume that the error is on the inspector bundle.

Thanks for your answers and especially cc @ryantrem

Hey @bvaisman, thanks for reporting this issue! That error translates to: Target container is not a DOM element. I’m guessing this means the root element we are trying to render React into is not an element. If you are not explicitly specifying the container element, then Inspector v2 will use the rendering canvas if there is one, otherwise it will fallback to document.body, so I’m not sure how we could end up with a null (or otherwise invalid) container element. Do you have a repro project you could share?

I will try to do that.

Thanks for your attention.

1 Like

Hey @ryantrem

Here’s a project to show you.

Here’s the URL : http://leo1.configurateurs.leonard-solutions.com/webapp/?m=p&u=21;{88392781-4b54-4692-857b-94d500365273}

Click on this button

image

Go to the console with F12

Be careful to chose the console for this site :

And type scene.debugLayer.show()

Thanks for your answer…

Hi @bvaisman - I was able to see this in your app and debug, and what I found is that you have a file named base_meshes.js with this:

class Node extends Objet {
    constructor(nom) {
        super();
        this.mesh = new BABYLON.TransformNode("");
        this.Set_Nom(nom);
        this.mesh.node = true;
        this.mesh.instance = this;
    }
}

Because this is not used in a module scope, it is effectively shadowing the Node class of WebAPI, so Inspector related code finds your class instead of WebAPI’s Node class. I think the best thing to do in this case is either use modules (perhaps impractical if that is a big change to your codebase) or make sure your global classes don’t use names that are part of WebAPI. Can you give that a try and let me know if you run into any other issues?

Hi @ryantrem ,

You solved the problem. I only have to rename the class and all the calls to it but it won’t be a huge work.

But can you tell me why it worked with the previous inspector ?

Thanks anyway for your help.

1 Like

Inspector v2 is an entirely new codebase, so it’s just different code. There is one place in the Inspector v2 code where it reads Node.ELEMENT_NODE, and that is what breaks because in your code it returns undefined instead of the expected 1.