Import errors after updating to 5.12.1

I’ve updated to the latest BabylonJS and get the following errors:

Uncaught (in promise) ShadowGeneratorSceneComponent needs to be imported before as it contains a side-effect required by your code.

This did not happen before.

In the file it points to I’m already importing this component:

import { ShadowGeneratorSceneComponent } from ‘@babylonjs/core/Lights/Shadows/shadowGeneratorSceneComponent’;

So whats the issue here?

This line gives me multiple errors now:

import ‘@babylonjs/inspector’;

This also used to work without issue.
The errors are:

ERROR in ./node_modules/@babylonjs/inspector/dist/babylon.inspector.bundle.max.js 3:143-175

Module not found: Error: Can’t resolve '@babylonjs/gui-editor

ERROR in ./node_modules/@babylonjs/inspector/dist/babylon.inspector.bundle.max.js 3:177-206

Module not found: Error: Can’t resolve ‘@babylonjs/loaders’

ERROR in ./node_modules/@babylonjs/inspector/dist/babylon.inspector.bundle.max.js 3:208-241

Module not found: Error: Can’t resolve ‘@babylonjs/serializers’

Commenting the line out gets rid of the errors but not sure what’s going on :slight_smile:

Anyone know what to change here?

@RaananW did some changes to move to peer dependencies last week and is unfortunately in vacation this week :frowning:

Can you share a repro of some sorts so we can try to have a look ?

I guess you do not have the peer dependencies installed for the loaders gui-editor and serializers ?

Hi, I don’t have repro for now, I’ll see if I can make one for a test.
But the issues did not exist before, I just reverted to an older BabylonJS version for now.

Do you get any warnings when installing the dependencies? npm should notify you of missing peer dependencies

I’ll get back to you as soon as possible.

Regarding the first error:

Uncaught (in promise) ShadowGeneratorSceneComponent needs to be imported before as it contains a side-effect required by your code.

In the file it points to I’m already importing this component:

import { ShadowGeneratorSceneComponent } from ‘@babylonjs/core/Lights/Shadows/shadowGeneratorSceneComponent’;

Any ideas as to why this happens when I update babylonJS? I took this from the docs on es6 tree shaking…

it fails even when importing the scene component? Can you share the project?

Try doing it like below without specifying which class to import:

import "@babylonjs/core/Lights/Shadows/shadowGeneratorSceneComponent";
1 Like

Thanks for the replies, issue was fixed by reinstalling all missing packages.

1 Like