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
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
compilation doesn't omit import statement that is not used in runtime if typescript alias is created from imported type
Input code
Config
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.7.4&code=H4sIAAAAAAAAA8vMLcgvKlGoDk7OSM1NLK5VSCvKz1VQ19MvqSxILdZLUbfm5cqEqHFMSSlKLS4OSi3OLy1KTlWwVYBq0kOTsQYAWJI5D1UAAAA%3D&config=H4sIAAAAAAAAA1VPOw7DIAzdOQXy3CHK0KF36CEQdSIqfsKOVBTl7oUE0maz38fveRVSwps0PORaxrJElQjTuReEsmf1KQhwjkg6mchw6yxTpSZlCXdoOxhglWbk6kIah3FoDrAhEHZHw5zxZsr%2FmTq4mJDoKqxS5WeL10TRUsGF17KT7Zfa92hwh5%2Boh52HwdCzOzktKLYvIO%2B2AhcBAAA%3D
SWC Info output
npx -y swc-info@latest
Expected behavior
import statement that is unsused in runtime is omitted
Actual behavior
import statement that is unsused in runtime is preserved
Version
1.7.4
Additional context
I'm using swc in my Vite project. After updating swc to version 1.3.89 I started seeing this error in the browser console.
swc prior to version 1.3.89 omitted import that was unused in runtime. That is why there was no such error in the browser console before.
Also I noticed if I use
import type
then swc of 1.3.89 version works as expected.swc output is
I guess this issue occured after issue #7177 was fixed.
The text was updated successfully, but these errors were encountered: