update rollup to version 4.53.2 #97
Open
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.
Issue summary
The current setup uses:
"rollup": "^4.27.4"This Rollup version still includes object tree-shaking, a feature known to be problematic because it can silently remove valid runtime code, resulting in broken builds and hard-to-detect logic errors.
What happens
During bundling, Rollup’s object tree-shaking analyzes and removes code it believes has no side effects on exports.
However, in many real-world cases (especially in physics or math-heavy libraries), it mistakenly strips out essential conditional logic.
This leads to invisible functional corruption — code still runs, but with degraded logic or performance.
Example: Physics engine (Cannon.js)
When building with the physics engine cannon.js, the following original function is part of the SAT (Separating Axis Theorem) algorithm:
This is a performance-critical early-exit check:
if the objects are not intersecting, the function returns early to avoid heavy collision computations.
After Rollup’s tree-shaking, the generated code becomes:
Notice that the early return (return false) has been removed.
As a result, every frame performs full collision clipping for all object pairs, causing a 3–4× performance regression.
This behavior occurs regardless of variable names or code formatting, since Rollup analyzes the AST and consistently removes such early exits when it deems them “unused.”
Impact
This issue is not limited to cannon.js; any library using imperative object-oriented logic (e.g., physics, math, or geometry code) may be affected.
Resolution
The issue is resolved in newer releases after PR #5736.