faceyspacey / webpack-flush-chunks

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

fix: account for there being no chunk with the same name as the chunk group #82

Open hedgepigdaniel opened 5 years ago

hedgepigdaniel commented 5 years ago

Webpack 4 introduced the concept of chunk groups.

I think there has been a false assumption in webpack-flush-chunks - that there is at least one chunk with the same name as the chunk group corresponding to the entry point or async chunk (provided via the before and after parameters and the chunkNames parameter respectively.

In an app I was working with this was not the case. The flushing of chunks was failing with the error "... check usage of babel plugin" because hasChunk was checking for a chunk with the required name, when it should instead be checking for a chunk group with the required name.

So the changes: