You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for looking into this! I tested the PR against our app (Vite 6.4 / Rollup, @babylonjs/core 9.37 ES6 packages). I built tools from fix/tree-shaking, linked it in place of the npm package, and compared per-module sizes from the Rollup bundle.
With Rollup, the sideEffects field changes almost nothing: only cinematic/events/apply-impulse.js drops out. Rollup already removes unused modules of the package on its own analysis. (It may help more with webpack.) Separately, master adds ~143 KB min / ~37 KB gzip over 5.5.0 even for a scene that doesn't use it, because of rendering/volumetric/*.
The real weight comes from code that is only reachable through loadScene. In our bundle, ~1.5 MB of unminified Babylon code (roughly 700 KB min) is pulled in only by editor-tools imports, almost all of it into the entry chunk:
@babylonjs/core/Particles (~520 KB): NodeParticleSystemSet, imported statically in decorators/apply.ts and loading/node-particle-system-set.ts
@babylonjs/core/PostProcesses + their shaders (~530 KB): SSR, SSAO2, TAA, motion blur, VLS, default pipeline, all imported statically by loading/rendering.ts through rendering/* (plus volumetric lighting on master)
@babylonjs/gui/2D (~240 KB): AdvancedDynamicTexture, imported statically in decorators/apply.ts
@babylonjs/core/Physics (~50 KB): PhysicsAggregate in loading/physics.ts
Since these are used inside functions reachable from loadScene, no bundler can drop them, with or without sideEffects. Our scene uses none of these features.
Would you consider the same approach you already use for the gui / navmesh preload plugins? Either:
load these features lazily with import() only when the scene data contains them (rendering configs, particle sets, GUI decorators, physics aggregates), or
make them opt-in plugins registered through a side-effect import (babylonjs-editor-tools/loading/plugins/post-processes, etc.). Your sideEffects list would then keep them only when the app imports them.
Either way, a scene that doesn't use them would stop paying for them. Happy to test a branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.