Modules all the way
This commit is contained in:
17
examples/webpack/worker-loader.cjs
Normal file
17
examples/webpack/worker-loader.cjs
Normal file
@@ -0,0 +1,17 @@
|
||||
/* eslint-disable import/no-commonjs */
|
||||
|
||||
const build = require('../../tasks/serialize-workers.cjs').build;
|
||||
|
||||
module.exports = function loader() {
|
||||
const callback = this.async();
|
||||
const minify = this.mode === 'production';
|
||||
|
||||
build(this.resource, {minify})
|
||||
.then((chunk) => {
|
||||
for (const filePath in chunk.modules) {
|
||||
this.addDependency(filePath);
|
||||
}
|
||||
callback(null, chunk.code);
|
||||
})
|
||||
.catch(callback);
|
||||
};
|
||||
Reference in New Issue
Block a user