Replies: 1 comment 1 reply
-
Why you think |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For now Rspack is using HashMap internally, HashMap is unordered, but in webpack, compilation.chunks is ordered, a real case:
https://github.com/web-infra-dev/rspack/blob/main/packages/rspack/tests/cases/chunks/issue-4338
webpack use MergeDuplicateChunksPlugin to remove the duplicate chunks, webpack will keep
0.js
,2.js
,c0.js
,c2.js
, but Rspack will keep0.js
,3.js
,c1.js
,c2.js
, this is caused by the different order of iteratingcompilation.chunks
between webpack and RspackFortunately, the order of
HashMap.keys()
is stable, so our output assets are also stable, but once we add more chunks intocompilation.chunk_by_ukey
, the structure of the HashMap will change, and we will have different output assets for these duplicate chunks, for example:In above case, if we add another
import()
, which will create another code-split point, and will add more chunks, the structure of thecompilation.chunk_by_ukey
will change, and the order will also change, the result of MergeDuplicateChunksPlugin might be:1.js
,3.js
,c1.js
,c3.js
and last time it is:
0.js
,3.js
,c1.js
,c2.js
the result is also correct, but it is bad for caching
Above example is only one case, we may have more potential cases
Beta Was this translation helpful? Give feedback.
All reactions