Please feel free to close if I’ve missed something, but after spending a couple days trying to upgrade to webpack 4 (
optimization.splitChunks), it seems like while we’ve gotten a lot of great additional behavior, we’ve also lost a really important one: I can no longer specify which chunks I want to contribute to the splits.
CommonsChunkPlugin, I had a vendor chunk that I specified be extracted explicitly from
entryA.js via the
chunks property. Of course, the vendor chunk was not extracted from any of the async chunks (which is a great feature of
splitChunks!), but I have a few other entry points that I don’t want split up, and I don’t know how to do it:
- I have
entryB.js, which should be a standalone js file for its own page.
- I have
workerC.js, which don’t share a runtime environment with the main thread (no
document, for example), so these must be standalone files. Yet, say
underscore—well, I have no way for it not to be split up if I want
entryA.jssplit up. Unless I’m missing something, this seems like a huge issue.
What is the expected behavior?
I would like to have a
chunks property inside a
cacheGroup that allows us to specify the entry file the splits should be taken from, or at least have a way to say ‘all (initial and async) except these files.’
What is motivation or use case for adding/changing the behavior?
I’m not sure I see a reasonable path forward here otherwise; maybe I should create multiple webpack configs and put the non-split files in those?
How should this be implemented in your opinion?
Bringing back the Commons-style
chunks property to some extent would be lovely.
Are you willing to work on this yourself?