-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
The current version (2.1.0) calls for terser^4.7.0, which on my machine gets resolved to terser@4.8.1. This version of terser does not support the modern js optional chaining ?., thinking it is a syntax error. Here's a minimal example:
const minifyStream = require("minify-stream")();
minifyStream.on("data",console.log);
minifyStream.write(`console.log({a:1}?.b);`);
minifyStream.end();
/**
throw er; // Unhandled 'error' event
^
te [SyntaxError]: Unexpected token: punc (.)
*/I see that the news commit calls out terser@5.4.1, however the optional chaining is also broken in that version too. However, terser@5.22.0 (newest as of post), does support. So providing the newest version of terser:
const minifyStream = require("minify-stream")({ uglify:require("terser") });
minifyStream.on("data",(d) => console.log(d.toString()));
minifyStream.write(`console.log({a:1}?.b);`);
minifyStream.end();
/**
inline source map not found
console.log({a:1}?.b);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJjb25zb2xlIiwibG9nIiwiYSIsImIiXSwic291cmNlcyI6WyIwIl0sIm1hcHBpbmdzIjoiQUFBQUEsUUFBUUMsSUFBSSxDQUFDQyxFQUFFLElBQUlDIn0=
*/Doesn't throw the error, but does seem to have an issue with the source maps.
Can we bump the version of terser?
(See this issue for background)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels