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

Chunk dependencies not flushed when it's moved to a parent #75

Open
eliseumds opened this issue Oct 10, 2018 · 0 comments
Open

Chunk dependencies not flushed when it's moved to a parent #75

eliseumds opened this issue Oct 10, 2018 · 0 comments

Comments

@eliseumds
Copy link

eliseumds commented Oct 10, 2018

There's this flag reuseExistingChunk of SplitChunksPlugin which, when true, moves a chunk up to the parent cache group to avoid outputting duplicated code, and doesn't generate any file for the source chunk itself. This conflicts with the behaviour of flushChunkNames() since it won't look for chunk dependencies inside stats.namedChunkGroups if it's not inside stats.chunks in the first place, but it should. More people might face this same issue because it's the default behaviour of splitChunks.cacheGroups.defaults.

To be honest, I'm not 100% sure if it's because of reuseExistingChunk. Maybe this is just the expected normal behaviour.

Scenarios:

  • User has defined a cache group but it only encompasses one module, meaning the group chunk will be generated but not a chunk for the source module
  • User has defined a cache group but, because of restrictions provided by minChunks, minSize, maxSize or any other config parameter, Webpack ends up moving a module to the parent chunk

Related code fragment:

if (!hasChunk(name, stats.assetsByChunkName, checkChunkNames)) {
return names
}
const files = filesByChunkName(name, stats.namedChunkGroups)
names.push(...files)
return names

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant