Commit 652c8924 authored by Robert Knight's avatar Robert Knight

Adapt to terser 5.0.0 API changes

Adapt to the `minify` function becoming async.
parent d32f168b
...@@ -27,17 +27,17 @@ function minifyStream() { ...@@ -27,17 +27,17 @@ function minifyStream() {
callback(); callback();
}, },
flush(callback) { async flush(callback) {
const code = Buffer.concat(this.chunks).toString(); const code = Buffer.concat(this.chunks).toString();
const minified = terser.minify(code, { const minifyResult = await terser.minify(code, {
// See https://github.com/terser/terser#minify-options-structure // See https://github.com/terser/terser#minify-options-structure
sourceMap: { sourceMap: {
content: 'inline', content: 'inline',
url: 'inline', url: 'inline',
}, },
}).code; });
this.push(minified); this.push(minifyResult.code);
callback(); callback();
}, },
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment