Do you want to request a feature or report a bug?
document not clear
What is the current behavior?
what optimization.splitChunks reuseExistingChunk: true means, can give a sample?
If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
can give a sample? reuseExistingChunk: true or false, what different?
If this is a feature request, what is motivation or use case for changing the behavior?
Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.
This issue was moved from webpack/webpack#7151 by @ooflorent. Original issue was by @8427003.
@sokra
I suggest saying in the doc that:
__The option reuseExistingChunk tells SplitChunks plugin to do additional lookup within existing chunks of current cachingGroup and try not to spawn additional chunks for matching modules if it is possible.__
I dont really see how to provide an example better, can you maybe advice @ooflorent
Here is an example:
Chunk 1 (named one): modules A, B, C
Chunk 2 (named two): modules B, C
With the splitChunk configuration of
{
minChunks: 2,
reuseExistingChunk: false // default
}
it would create a new chunk containing the common modules B and C:
Chunk 1 (named one): modules A
~Chunk 2 (named two): no modules~ (removed by optimization)
Chunk 3 (named one~two): modules B, C
With the splitChunk configuration of
{
minChunks: 2,
reuseExistingChunk: true
}
it would reuse the existing chunk 2 because it matches the modules selected by the cacheGroup:
Chunk 1 (named one): modules A
Chunk 2 (named two): modules B, C
==>
There is a difference in the resulting name. If you don't have names there is no difference.
Thanks for input, will modify the page soon
PR here - #2199
Thanks for tackling this one @chrisdothtml , im on road trip across europe till 11th of june thats why it got stalled on my side 馃憤
@sokra
I tried, but it turned out not to be this way. When i set reuseExistingChunk to true, still produces three files
Most helpful comment
Here is an example:
Chunk 1 (named one): modules A, B, C
Chunk 2 (named two): modules B, C
With the splitChunk configuration of
it would create a new chunk containing the common modules B and C:
Chunk 1 (named one): modules A
~Chunk 2 (named two): no modules~ (removed by optimization)
Chunk 3 (named one~two): modules B, C
With the splitChunk configuration of
it would reuse the existing chunk 2 because it matches the modules selected by the cacheGroup:
Chunk 1 (named one): modules A
Chunk 2 (named two): modules B, C
==>
There is a difference in the resulting name. If you don't have names there is no difference.