Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what reuseExistingChunk: true means, can give a sample? #2122

Closed
webpack-bot opened this issue May 8, 2018 · 5 comments

Comments

@webpack-bot
Copy link

commented May 8, 2018

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.

@EugeneHlushko

This comment has been minimized.

Copy link
Member

commented May 8, 2018

@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

@sokra

This comment has been minimized.

Copy link
Member

commented May 13, 2018

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.

@EugeneHlushko

This comment has been minimized.

Copy link
Member

commented May 14, 2018

Thanks for input, will modify the page soon

@chrisdothtml

This comment has been minimized.

Copy link
Member

commented May 26, 2018

PR here - #2199

@EugeneHlushko

This comment has been minimized.

Copy link
Member

commented May 29, 2018

Thanks for tackling this one @chrisdothtml , im on road trip across europe till 11th of june thats why it got stalled on my side 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.