Find more merge targets for experimentalMinChunkSize#5294
Find more merge targets for experimentalMinChunkSize#5294lukastaegert merged 5 commits intomasterfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Thank you for your contribution! ❤️You can try out this pull request locally by installing Rollup via npm install rollup/rollup#improve-minchunksizeNotice: Ensure you have installed Rust nightly. If you haven't installed it yet, please first see https://www.rust-lang.org/tools/install to learn how to download Rustup and install Rust, then see https://rust-lang.github.io/rustup/concepts/channels.html to learn how to install Rust nightly. or load it into the REPL: |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5294 +/- ##
=======================================
Coverage 98.82% 98.82%
=======================================
Files 232 232
Lines 8957 8962 +5
Branches 2336 2336
=======================================
+ Hits 8852 8857 +5
Misses 46 46
Partials 59 59 ☔ View full report in Codecov by Sentry. |
|
This PR has been released as part of rollup@4.8.0. You can test it via |
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Description
This very much improves the merge algorithm for
experimentalMinChunkSizewhen many dynamic imports are used. Previously, the side effect detection in the algorithm would not take into account whether a module was already in memory because it was a dependency of a dynamic importer.This could lead to a sub-optimal situation where potentially a lot of possible merges were not applied. Take this example:
E is the entry point and has a side effect.
E dynamically imports D1 and D2.
E, D1, D2 all statically import a shared dependency S
Now the vanilla Rollup chunking algorithm has an optimization so that in this situation, it would merge S into E so that D1 and D2 import S from E. This is not a problem because we know E is in memory when either is loaded.
However this messed up
experimentalMinChunkSize. Because E was not an explicit static dependency of either D1 or D2, merging either of these chunks would tell the algorithm that it would be bringing the side effect in E into a place where it was not a dependency before.But of course this is not a problem because the effect in E was already executed long before either D1 or D2 was imported. This is fixed in this PR by leveraging the extended dynamic dependency information gathered in the original algorithm.
cc @gajus