require() of ES Module E:\XXX\next-babylonjs1\node_modules\@babylonjs\core\index.js from E:\XXX\next-babylonjs1\node_modules\@babylonjs\inspector\dist\babylon.inspector.bundle.max.js not supported.
Instead change the require of index.js in E:\XXX\next-babylonjs1\node_modules\@babylonjs\inspector\dist\babylon.inspector.bundle.max.js to a dynamic import() which is available in all CommonJS modules.
The inspector package is still not fully esm compatible. We will take care of that as part of the future esm package work. Sorry 'bout that, I don’t have a good solution for that at the moment
Hi, I just came across this issue and have used a dynamic import of a custom component.
Probably not a great solution but seems to work around the ESM issue for local debugging, etc.
Main page where I want to use the debugger:
// set the scene on sceneReady call
let sceneRef = useRef<Scene | null>(null);
// dynamic import of the custom component
const Debugger = dynamic(() => import("../components/Debugger"), {
ssr: false,
});
...
// in my return render of page
<Debugger sceneRef={sceneRef} />
@11128, yep! much simpler !
Although I needed to await the import
As an update to what I posted originally, remove the custom component and have a function call to dynamically import the inspector module (and display the debugger) at the bottom of my onSceneReady function.