Use mode from the loader context

See https://github.com/webpack/webpack/pull/9140.
This commit is contained in:
Tim Schaub
2019-05-20 10:33:59 -06:00
parent 60007d8e3c
commit c0339f167b

View File

@@ -2,14 +2,7 @@ const build = require('../../tasks/serialize-workers').build;
function loader() {
const callback = this.async();
let minify = false;
// TODO: remove when https://github.com/webpack/webpack/issues/6496 is addressed
const compilation = this._compilation;
if (compilation) {
minify = compilation.compiler.options.mode === 'production';
}
const minify = this.mode === 'production';
build(this.resource, {minify})
.then(chunk => {