Failing to import the Inspector

Hello,

I’ve been following this documentation to show the Inspector in a scene I’m debugging.

//#region Imports

import "@babylonjs/core/Debug/debugLayer"; // Augments the scene with the debug methods
import "@babylonjs/inspector"; // Injects a local ES6 version of the inspector to prevent automatically relying on the none compatible version
import { SceneLoader } from "@babylonjs/core/Loading/sceneLoader";
import {GLTFFileLoader} from 'babylonjs-loaders';
import { Engine } from "@babylonjs/core";

import { CreateEngine, OptimiseEngine } from './viewModels/utils/PerfUtils';
import * as MainScene from "./viewModels/main/MainScene";

//#endregion

const canvas = document.getElementById("renderCanvas") as unknown as HTMLCanvasElement;
SceneLoader.RegisterPlugin(new GLTFFileLoader());

const engine: Engine = CreateEngine(canvas, false, { powerPreference: 'high-performance' });
const scene = MainScene.CreateScene(engine);

scene.debugLayer.show();

Unfortunately, I’m met with the error:

ERROR in ./node_modules/@babylonjs/loaders/glTF/glTFFileLoader.js 961:0-25
export 'registerSceneLoaderPlugin' (imported as 'registerSceneLoaderPlugin') was not found in '@babylonjs/core/Loading/sceneLoader.js' (possible exports: SceneLoader, SceneLoaderAnimationGroupLoadingMode)
 @ ./node_modules/@babylonjs/loaders/glTF/index.js 2:0-36 2:0-36
 @ ./node_modules/@babylonjs/loaders/index.js 2:0-32 2:0-32
 @ ./node_modules/@babylonjs/inspector/dist/babylon.inspector.bundle.max.js 3:177-206
 @ ./src/index.ts 31:0-31

Apprently it’s related to the @babylonjs/loaders module? I don’t understand why, it seems it can"t find the module? I’ve tried installing it both as a dev package and normal package, but nothing changed. Any suggestion would be helpful.

1 Like

You mix 2 types of import: with @ ( Core ES6-supported version) and without @.

You need at least change the import from babylonjs-loaders to @babylonjs/loaders

1 Like

Hello labris, indeed I had installed the wrong version of babylonjs/loaders. I uninstalled the old version, installed the inspector and loaders modules, and updated the babylonjs/core and gui modules to remove the compatibility issues. It works perfectly fine now. Thank you for your time.

1 Like