Try to open the Inspector using NextJS but it said [ERR_REQUIRE_ESM]

I’ve imported the package directly following the docs.

import "@babylonjs/core/Debug/debugLayer";
import "@babylonjs/inspector"
{
scene.debugLayer.show();
}

Then it shows err message below:

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.

:smile:

Hello and welcome to the Babylon community! cc @RaananW

1 Like

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

:smiley:OK,Thank you~