Attempting to load @ babylonjs/inspector using nuxt.js with error message

1、use import “@babylonjs/core/Debug/debugLayer”;
import { Inspector } from “@babylonjs/inspector”;
console.log(Inspector, Inspector);
error:Instead change the require of index.js in D:\code\polybasic-project\nuxt_demo\nuxt3-test\node_modules@babylonjs\inspector\dist\babylon.inspector.bundle.max.js to a dynamic import() which is available in all CommonJS modules.
2、use Promise.all([
import(“@babylonjs/core/Debug/debugLayer”),
import(“@babylonjs/inspector”),
]).then((_values) => {
console.log(_values===,_values);
scene.debugLayer.show({
handleResize: true,
overlay: true,
globalRoot: document.getElementById(“canvas”) || undefined,
});
});
error:Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘Debug’)

Try removing the first import, which is technically not needed. The error is complaining about the missing BABYLON global namespace.

thank you,It has already been loaded

1 Like