As soon as I do
import * as BABYLON from "babylonjs";
import "babylonjs-loaders";
import { ShowInspector } from "@babylonjs/inspector";
I get build error:
WARNING in ./node_modules/@babylonjs/gui-editor/dist/babylon.guiEditor.js 1:1407132-1407189
Module not found: Error: Can't resolve '@fortawesome/fontawesome-svg-core/package.json' in 'C:\babylon\node_modules\@babylonjs\gui-editor\dist'
@ ./node_modules/@babylonjs/inspector/lib/index-PYblOaAV.js 21760:54-85 21050:46-77
@ ./node_modules/@babylonjs/inspector/lib/index.js 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453 1:0-3453
...
It worked fine till 9.0.0 inclusive. Later it stopped, even if I revert it back to 9.0.0. Probably one of downstream dependencies got broken sometime after the release of 9.0.0. So, no matter which version I am going to use, npm install pulls a broken dependency, because it was defined as “^x.x.x” and consumed something bad on full re-install (that’s my hypothesis, though).
I created a minimal CodeSandbox example: https://codesandbox.io/p/sandbox/8jrqs4. Unfortunately, CodeSandbox doesn’t print build errors, but if you will comment out the Inspector import, then everything starts to work instantly. This sandbox is just to demonstrate that the issue is there.
Appendix:
Just to save everybody’s time and not to flood with unrelated conversations.
- There are reasons why I prefer classic
babylonjs-*imports instead of new@babylon/*for most of the BabylonJS things. What important is that it worked well before, even if I used@babylonjs/inspectorfor inspector only. - I tried to do
import "babylonjs-inspector"instead as the docs suggest, but it led to another dependency related build errors.