An ill-named rollup plugin to add worker bundling support. With this plugin you can just use the
new Worker("somefile.js") constructor and rollup will bundle that file and its dependencies into a separate chunk — similar to what happens with a dynamic import.
$ npm install --save rollup-plugin-workz0r
Note: If you are a webpack user, take a look at worker-loader.
// rollup.config.js;input: "src/main.js"plugins:;
The modules-in-workers problems
At the time of writing, no browser has support for ES6 modules in workers. Until browsers have caught up, I wrote
rollup-plugin-loadz0r to make modules in workers “just work”. If you want to use these two plugins in conjunction, some extra plumbing is needed to let
loadz0r know which chunks are worker chunks, as they need the loader code, too:
// rollup.config.js;;const workerModules = ;input: "input.js"output:dir: "./dist"format: "amd"plugins:;