The tree shaking optimization has failed in @babylonjs/core

Hey, team! I just notice that the tree shaking optimization has failed in @babylonjs/core.I provide a demo below. In this demo, I only import an AnimationGroup and when I build the demo and analyze the dist, I see that all deps are packaged into the dist. Is that a bug or I just used it in a wrong way?

babylon-es.zip (173.1 KB)

I see the sideEffects in the @babylonjs/core package.json.


Is that in case? It means all files have side effects except the src/Maths/ThinMaths/**.
The @babylonjs/core was designed to be all packaged, I’m not sure if my understanding is correct

Can you show the import part of your code?

You have to manually only import the parts you need, if you import “babylon/core” it brings everything

Hi.

Just quirious, how do you generate such chart?

Also, Culling module has side effects, it monkey-patch Scene and Camera for picking.

It’s a rollup plugin named rollup-plugin-visualizer

Sure, it’s not that easy for @babylonjs/core tree shaking due to the compat problem

This can help Babylon.js docs