Hi, I just arrived at a working patch for terser-webpack-plugin to circumvent breaking changes in node-terser 5 which is required by the package. The available version of node-terser in debian is 4 which is behind the terser package upstream.
This patch is an ad-hoc fix for the bug pending the node-terser package is updated to a compatible version. Here is the proposed patch: https://salsa.debian.org/calebpitan/node-webpack/-/commit/208febe14d117dc134543fd9773c8eca02d1d68c.patch --- a/terser-webpack-plugin/src/utils.js +++ b/terser-webpack-plugin/src/utils.js @@ -264,8 +264,11 @@ async function terserMinify(// Let terser generate a SourceMap
if (sourceMap) { - // @ts-ignore - terserOptions.sourceMap = { asObject: true }; + const pkg = require("terser/package.json") + if (parseInt(pkg.version) > 4) { + // @ts-ignore + terserOptions.sourceMap = { asObject: true }; + } }/** @type {ExtractedComments} */
@@ -284,7 +287,11 @@ async function terserMinify( }const [[filename, code]] = Object.entries(input);
- const result = await minify({ [filename]: code }, terserOptions); + let result = minify({ [filename]: code }, terserOptions); + + if (result instanceof Promise) { + result = await result + }return {
code: /** @type {string} **/ (result.code),
OpenPGP_0x8A1B2CC96775D2D7.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature