Replies: 1 comment
-
Sorry for delay, you can use:
Otherwise webpack tries to split all possible chunks, inclused CSS stuff.
That is interesting question, because both examples make sense... I am fine with dicussion about it |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Example
Say we have a module relationship like this:
Before splitChunks, we have 2 chunks here, one for
a
and one forb
.We set cacheGroups.default.text to
/x|y/
, sox
andy
both match, and will be split later (assume that we match the minSize here).The default strategy of splitChunks, will split
x
in a common chunk , which is expected as it shows up in 2 chunks. Andy
still only appear in chunka
.But if we set cacheGroups.default.name to any value,
x
andy
appear in the same chunk. Ifx
andy
are css modules, this behavior will cause some priority problems.Code Sandbox
https://codesandbox.io/p/sandbox/bold-orla-5xqm5d?file=%2Foutput%2Findex.js%3A12%2C19
run
npm run build
, see the result, and comment or uncomment cacheGroups.default.name, see the differencesQuestions
I know the reason in source code, its because the key of
chunkInfoMap
is affected by name if specified, otherwise it is based on the chunks combinations.But I do not know if this is by design or a bug, personally I feel confused if name affects splitChunks results
Beta Was this translation helpful? Give feedback.
All reactions