SyntaxError when using v10.5.2 on node v14.16.1
DonCziken opened this issue · 11 comments
I've encountered following issue when using latest version of the module (v10.5.2) and following node/npm set up
node: v14.16.1
npm: v6.14.12
npm i minify -g
minify abc.html > minified/abc.html
cat > minified/abc.html
SyntaxError: Unexpected token '??='
at Loader.moduleStrategy (internal/modules/esm/translators.js:145:18)
I could fix the problem by:
- falling back to earlier version of module (tested with v9.1.0)
- using more recent node/npm (tested with v21.1.0/v10.2.1)
While I am aware that it's extremely complex to ensure backward compatibility in node environments, however I wonder if maybe you could introduce some warnings or supported version constraints for newer versions, so when using specific node I won't use version which is not compatible with it.
cheers,
Krzysztof
I face the exact same issues with JS files, under v.10.5.2
As an example you can try this file before and after minifization: https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.js
Please use latest version of node.js, node v14 and node v16 are end of life. Anyways a new option can be introduced, but it wan’t be a node.js version.
I tested that with node 20.9
Could you please provide minimal example of code that has issues with Minify
for me it was literally any .html file and just minfy file.html > out.html
, tough I guess @sakiss example is more important here.
Anyway, @coderaiser thanks for looking up at the issue.
Try to minify the js file i supplied in my 1st message.
Then load it in an html file and check your browser's error console.
Try to minify the js file i supplied in my 1st message.
Then load it in an html file and check your browser's error console.
I see no js file in your first message, could you provide one?
Try to minify the js file i supplied in my 1st message.
Then load it in an html file and check your browser's error console.I see no js file in your first message, could you provide one?
He pointed to flatpickr: https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.js
Could you please provide minimal reproducible example (< 20 lines)
Closed due to a long time of inactivity 🏝