Add worker loader to the examples

This commit is contained in:
Tim Schaub
2019-05-15 16:49:38 -06:00
parent e307410301
commit 05f13bb363
4 changed files with 71 additions and 1 deletions

View 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;