Improve loaders to use the vendor chunk and reduce their size #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5.
Instead of child compiling workers (which does not reuse the common chunk and increases worker size) this change makes webpack compile the workers in the main bundle. This way it reuses requires from the vendor chunk. After the compile the plugin extracts each worker module in a separate chunk file and also creates a similar to the
starter.js
file for every worker.In order the vendor chunk to be reused inside the workers, any UI related imports need to be excluded for the worker. That's why the starter file for the worker raises a
global.__worker
flag which is then used in the vendor file to conditionally import the UI modules.