Add worker loader to the examples
This commit is contained in:
16
examples/webpack/worker-loader.js
Normal file
16
examples/webpack/worker-loader.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const build = require('../../tasks/serialize-workers').build;
|
||||
|
||||
function loader() {
|
||||
const callback = this.async();
|
||||
|
||||
build(this.resource, {minify: false})
|
||||
.then(chunk => {
|
||||
for (const filePath in chunk.modules) {
|
||||
this.addDependency(filePath);
|
||||
}
|
||||
callback(null, chunk.code);
|
||||
})
|
||||
.catch(callback);
|
||||
}
|
||||
|
||||
module.exports = loader;
|
||||
Reference in New Issue
Block a user