Support for SplitChunksPlugin#63
Conversation
|
But webpack/webpack#7879 (comment) said webpack did not support |
It can be done, but I wish it was handled internally by webpack. By the way it can also be done asynchronously (even when it's bad for debugging), by using fetch rather than importScripts, then executing as function, in that sense, all fetching will be done at once, rather than importScripts which is sync, however, fetch is terrible for debugging purposes. |
|
Shouldn't this already work just by adding Update: I can confirm that chunk loading was already working, shown in this test that does code splitting via dynamic import (fixture). |
Searched around and came across webpack/webpack#6472, worker-injector-generator-plugin and a stackoverflow answer
This adds support for sharing chunks between workers / main entry points.
To use it, you can put your rules under
webpackConfig.splitChunks.Make sure to define
webpackConfig.splitChunks.cacheGroupsAnd make sure globalObject is set to self