You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After minifying the code with swc the code contains a reference error. The variables inside the destructured assignmend are correctly renamed, but not all references are updated accordingly. In the snippet below the url variable will be renamed, but the value of the shorthand property in the returned object won't be updated and still points to url.
Expected behavior
I expect all references of a variable to be renamed. This includes updating references to shorthand properties in objects, whilst keeping the property name intact. The expected output would be:
marvinhagemeister
changed the title
Missing variable after minification
ReferenceError after minification due to mangled variable name not applied to shorthand property
Aug 10, 2021
swc_ecma_minifier:
- Test mangler using execution test suite.
- `mangler`: Preserve `arguments`.
- `mangler`: Handle shorthand. (#2051)
- `mangler`: Handle object pattern properties.
- `precompress`: Don't drop function declarations if the variable with same name is in different scope. (#2011)
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Describe the bug
After minifying the code with
swc
the code contains a reference error. The variables inside the destructured assignmend are correctly renamed, but not all references are updated accordingly. In the snippet below theurl
variable will be renamed, but the value of the shorthand property in the returned object won't be updated and still points tourl
.Input code
Incorrectly generated output:
Note, that the property in the returned object isn't updated.
Config
Expected behavior
I expect all references of a variable to be renamed. This includes updating references to shorthand properties in objects, whilst keeping the property name intact. The expected output would be:
Version
The version of @swc/core:
1.2.76
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: