-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix(es/resolver): Resolve top-level undefined
, NaN
, and Infinity
correctly
#8471
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
Conversation
...sue_597/NaN_and_Infinity_should_not_be_replaced_when_they_are_redefined/output.mangleOnly.js
Outdated
Show resolved
Hide resolved
crates/swc_ecma_minifier/tests/terser/compress/issue_597/beautify_off_1/output.js
Outdated
Show resolved
Hide resolved
crates/swc_ecma_minifier/tests/terser/compress/issue_597/beautify_on_1/output.mangleOnly.js
Outdated
Show resolved
Hide resolved
crates/swc_ecma_minifier/tests/terser/compress/issue_597/beautify_off_1/output.js
Outdated
Show resolved
Hide resolved
crates/swc_ecma_minifier/tests/terser/compress/issue_597/beautify_off_1/output.js
Outdated
Show resolved
Hide resolved
I think the problem here may be the fact that we use ESM mode for terser test suites |
Yes. I would open a separate PR for this. Doesn't seem like to have any problem. |
Some investigation, for following code var NaN = 1
console.log(NaN) Result would be
Seems like the benefit of this mechanism is very limited. Maybe just remove it? |
I agree that the benefit is small, but I also think code is trivial enough to justify the size of benefit |
undefined
NaN
Infinity
decl…undefined
, NaN
, and Infinity
correctly
Fine. Let's proceed this way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you all!
swc-bump:
- swc_ecma_ast
- swc_ecma_transforms_base
…aration correctly in es module
What does this mean? Should SWC skip them when renaming? |
Maybe just remove the special treatment for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automated review comment generated by auto-rebase script
…aration correctly in es module
Description:
For following code
Result would be
So SWC choose to behave like browser in script mode and confirm to esm standard.
BREAKING CHANGE:
Related issue (if exists):
Closes #8465