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
SWC renames a TypeScript namespace in a script file to have a 1 on the end, but a name in a script file could be used by consumers in other files that aren't compiled by swc.
This only started happening recently in swc.
Input code
Also happens with enums, but here's an example with namespaces:
// test.tsnamespaceTest{exportconsttest=1;}
npx swc test.ts
Playground link
The playground has different behaviour because it's not doing a hygiene pass.
Edit: actually, it is doing this when mangle is turned off, but maybe that is ok because module is set to "common js"? The source type is set to script though.
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
SWC renames a TypeScript namespace in a script file to have a
1
on the end, but a name in a script file could be used by consumers in other files that aren't compiled by swc.This only started happening recently in swc.
Input code
Also happens with enums, but here's an example with namespaces:
Playground link
The playground has different behaviour because it's not doing a hygiene pass.Edit: actually, it is doing this when mangle is turned off, but maybe that is ok because module is set to "common js"? The source type is set to script though.
https://play.swc.rs/?version=1.2.111&code=H4sIAAAAAAAAA8tLzE0tLkhMTlUISS0uUajm5VJQSK0oyC8qUUjOzwOKhCXmlKYq2CoYWvNy1fJy8XKBhPNzUvVy8tM1QHr0wCo0rQFv9PpSSgAAAA%3D%3D&config=H4sIAAAAAAAAA0WOQQ6DMAwE%2F%2BIzh5Yjf%2BgjomBQEIkjr5GKEH%2BvobTcrN2dkTeaEKnbqAYF63FhLRbe1JGtlRE1VaOGDB4NYQY31HMUDSYK6kwX3r0OOrI5xGgf7dOBWQT8R3IqaVgPfZRclYG7CmWcf8vdXVn65Qi28wN3OpKlTKD9Fl1wwutaf%2FEP2XIXPNAAAAA%3D
Expected behavior
Actual behaviour
Version
1.2.111
Additional context
No response
The text was updated successfully, but these errors were encountered: