Modules all the way

This commit is contained in:
Tim Schaub
2020-02-20 18:30:09 -07:00
parent ae70a1fb9d
commit c301d2413b
29 changed files with 316 additions and 173 deletions

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