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
Minifier incorrectly renames identifiers #8790
Comments
This is the expected behavior and it aligns to terser. In this situation, JS behavior can be divided into two categories
var a = undefined;
const text = a("Hello world");
var a = undefined;
const text = btoa("Hello world"); However, there's no standardized list of what runtime may provide, so we only respect this behavior to a very limited common subset namely |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
The minifier incorrectly renames identifiers if the variable name is the same as the value's identifier, eg
var btoa = btoa;
becomesvar l = l;
Input code
Config
No response
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.3.100&code=H4sIAAAAAAAAAytLLFJIKslPVLAFU9a8XLxcyfl5xSUKJakVJVBRDSWP1JycfIXy%2FKKcFCVNoCIAtAg4yzcAAAA%3D&config=H4sIAAAAAAAAA32QTQ6CMBCF95yCzNoFsjDGO3gGM6kDKba06RQiIdzd8lOESNy0nfe%2B6WRen6QpVCzglvbhGQqLjsmtdVC4qz2%2BgwIkNLJw0no4Rbfi0SpQMU3SMDvg0ZXkpy7OszxfOkAZwxQ7Fk3LWhbddqYw2jpi3oMjinWpaIOOo4xV1JIKqnfNygbnRWQfQiFzjZp%2BfotE8de1TrboKdzGHkGSrgcqY4FOnrNdOCGeJJ5TUKDNs9nsA76zNId2gS8U84nrgeR7bBy1ZPgAtz%2FrR8kBAAA%3D
SWC Info output
No response
Expected behavior
The expected output should be something like:
Actual behavior
The variable's value becomes the variable's new name, causing incorrect behaviour
Version
1.3.100
Additional context
No response
The text was updated successfully, but these errors were encountered: