use older Nodejs module terser 4.x

This partly reverses upstream git commit 9f7cbad.
Last-Update: 2020-12-13

Gbp-Pq: Name 2001_use_older_terser.patch
This commit is contained in:
Jonas Smedegaard 2022-07-16 11:47:25 +08:00 committed by Lu zhiping
parent 9e4b282b81
commit 9ff4c86228
2 changed files with 8 additions and 1 deletions

View File

@ -9,6 +9,7 @@ Object {
"exports": Array [],
"fileName": "chunk-1.js",
"implicitlyLoadedBefore": Array [],
"importedBindings": Object {},
"imports": Array [],
"isDynamicEntry": false,
"isEntry": true,
@ -25,6 +26,7 @@ Object {
"exports": Array [],
"fileName": "chunk-2.js",
"implicitlyLoadedBefore": Array [],
"importedBindings": Object {},
"imports": Array [],
"isDynamicEntry": false,
"isEntry": true,

View File

@ -2,7 +2,12 @@ const { minify } = require("terser");
const transform = (code, optionsString) => {
const options = eval(`(${optionsString})`);
return minify(code, options).then(result => ({ result, nameCache: options.nameCache }));
const result = minify(code, options);
if (result.error) {
throw result.error;
} else {
return { result, nameCache: options.nameCache };
}
};
exports.transform = transform;