Build error using Vite JS and version 5.0.3

Hi guys, I’m fairly new to the Babylon world. I’m having some issues with building my project. I’m using Vite Js and when I try to build it gives me the following error :

node_modules/@babylonjs/inspector/dist/babylon.inspector.module.d.ts:316:28 - error TS2307: Cannot find module ‘@babylonjs/shared-ui-components/tabs/propertyGrids/lockObject’ or its corresponding type declarations.

316 import { LockObject } from “@babylonjs/shared-ui-components/tabs/propertyGrids/lockObject”;

I’m currently using babylon version 5.0.3.

Hi @d1once,

Welcome to the forum! :slight_smile:

This was supposed to be fixed on 5.0.3, but let me check to be sure.
If not - will be fixed on the next version. Thanks for reporting!

How are you importing Babylon? And more specifically, how are you importing inspector?If you are trying to import individual modules (for tree shaking), then importing inspector can be difficult. I usually just import the legacy module whenever I want to use inspector (negating any tree shaking).

Here’s example showing 5.0.3 does work with vite, but again, how you import things is important and there are multiple options.

Yes, I’m indeed importing individual modules however I’m importing the inspector in my main file like this :

import "@babylonjs/core/Debug/debugLayer";
import "@babylonjs/inspector";

Inspector works like a charm, but the idea is that when I try to build my project I get the error above.

I can confirm that a fix will be arriving shortly.

This is a typing issue only, as the classes are included in the bundle. My project build didn’t trigger this, but I can confirm the missing package. It should build correctly, but should of course be fixed.

I also added this - [Build] Add build test for projects using umd and es6 · Issue #12350 · BabylonJS/Babylon.js ( that should prevent from those issues to ever happen.

Thanks again!

1 Like

Hi @RaananW just checking on stuff, was the fix done?

Yes, this was fixed in 5.1.0

1 Like