New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect transformation of nullish coalescing operator when passing "ecma" option. #1003
Comments
ruipin
added a commit
to ruipin/fvtt-lib-wrapper
that referenced
this issue
Jun 4, 2021
Seems that terser doesn't handle the nullish coalescing operator correctly in a specific corner case: terser/terser#1003 This caused wrappers on overridden properties to fail.
I'd like to note that this is quite a critical bug. It silently changes the logic of the application. I have a Vue + webpack application with minification only active on production builds. So for use, this bug only becomes visible when the application hits QA, but the developers don't see it while coding. |
cc @fabiosantoscode I think critical |
rricard
pushed a commit
to rricard/terser
that referenced
this issue
Aug 20, 2021
rricard
pushed a commit
to rricard/terser
that referenced
this issue
Aug 20, 2021
This PR does 2 things: - It removes special casing for nullish coalescing (??) in negation - This fixes terser#1003 - We also made sure optional chaining (?.) is ok - This cements terser#1007 as fixed
fabiosantoscode
pushed a commit
that referenced
this issue
Aug 22, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
Version (complete output of
terser -V
or specific git commit)terser 5.6.1
Complete CLI command or
minify()
options usedterser test.js -c ecma=2020
Note that the issue can be reproduced with any value for
ecma
, e.g.terser test.js -c ecma=1
,terser test.js -c ecma=2000000
,terser test.js -c ecma
, etc.The issue does not occur if the
ecma
parameter is omitted, i.e.terser test.js
.terser
inputA
test.js
file containing:terser
output or errorExpected result
For reference, this is the output when not passing any
ecma
parameter.To see why the output is incorrect code, see e.g.
The text was updated successfully, but these errors were encountered: