Skip to content
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

Open
levi-nz opened this issue Mar 29, 2024 · 0 comments
Open

Minifier incorrectly renames identifiers #8790

levi-nz opened this issue Mar 29, 2024 · 0 comments

Comments

@levi-nz
Copy link
Contributor

levi-nz commented Mar 29, 2024

Describe the bug

The minifier incorrectly renames identifiers if the variable name is the same as the value's identifier, eg var btoa = btoa; becomes var l = l;

Input code

var btoa = btoa;

const text = btoa("Hello world");

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:

var l=btoa;const o=l("Hello world");

Actual behavior

The variable's value becomes the variable's new name, causing incorrect behaviour

Version

1.3.100

Additional context

No response

@levi-nz levi-nz added the C-bug label Mar 29, 2024
@kdy1 kdy1 modified the milestone: Planned Apr 1, 2024
@kdy1 kdy1 removed the C-bug label Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants