faceyspacey / webpack-flush-chunks

💩 server-to-client chunk discovery + transportation for Universal Rendering
MIT License
355 stars 33 forks source link

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

Open eliseumds opened 6 years ago

eliseumds commented 6 years ago

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:

Related code fragment: https://github.com/faceyspacey/webpack-flush-chunks/blob/b3534a330096b40912a0735e518b047563aa61bf/src/flushChunks.js#L233-L238