Import Bug with `npm install @babylonjs\inspector` (proposed fix included)

When importing @babylonjs\inspector to my project via npm install @babylonjs\inspector it imports everything correctly. However, when I go to import via import "@babylonjs/inspector" at the top of my .ts file…i get an error:

Error: node_modules/@babylonjs/inspector/dist/babylon.inspector.module.d.ts:4970:170 - error TS2307: Cannot find module './types' or its corresponding type declarations.
4970 export const getPosInLayout: (layout: Layout, column: number, row?: number | undefined) => import("@babylonjs/inspector/components/layout/types").LayoutTabsRow | import("./types").LayoutColumn;

I can simply fix this by changing: import("./types").LayoutColumn to import("@babylonjs/inspector/components/layout/types").LayoutColumn.

But obviously its not good to modifiy stuff in /node_modules as it will be overwritten via any npm install etc

that should work, i’ll have to see what happened. Just making sure, are you using the latest version of the inspector?

2 Likes

Yeah I believe I am using the latest…@babylonjs/inspector": "^5.31.2. Just upgraded everything a few days ago

1 Like

import types to fix d.ts for inspector by RaananW · Pull Request #13255 · BabylonJS/Babylon.js (github.com)

Will be available in a new version, released tomorrow.

3 Likes

Awesome…I’ll be sure to update my version as soon as it goes out. Thanks for the fix

1 Like

Hello again @RaananW . So I updated everything to:

    "@babylonjs/core": "^5.33.0",
    "@babylonjs/gui": "^5.33.0",
    "@babylonjs/inspector": "^5.33.0",
    "babylonjs": "^5.33.0",

And it seems to have resolved the original error, but now there is another error present in that file. Its basically a bunch of:

node_modules/@babylonjs/inspector/dist/babylon.inspector.module.d.ts:7012:33 - error TS2304: Cannot find name 'StoryObj'.

on a bunch of lines. I don’t know why your change would affect that haha, but it seems that class StoryObj is not being imported in now.

looks like we might be leaking stories in the actual package ??? not sure they should be released @RaananW

i’ll check that.

Addressing export issue by RaananW · Pull Request #13270 · BabylonJS/Babylon.js (github.com)

This will be fixed by this PR. I will rebuild right after this is merged.

Just wanted to note - there is no need to add both babylonjs and @babylonjs/core . one is enough (core in your case, since you are using es6).

1 Like

Everything seems to be working. Thanks man!

2 Likes