-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Tree shaking for cross-module inlined enum values does not work #10384
Comments
Would you provide a reproduction of this? |
Thanks for the repro! This does not work because of the limitation of If you set |
Thanks for your reply! |
Ah, I got it. Non cross-module enums are inlined because esbuild specially supports it (evanw/esbuild#128). To support cross-module enums inlining, the tool needs to know both:
But in Vite, TypeScript syntax is processed by esbuild and module graph is handled by rollup. So it's not possible to support. |
Thanks for your reply! |
I guess you could also use |
You'll need to add |
Oh, I got it. Thank you very much. |
Describe the bug
I want to use
const enums
instead ofenum
to optimize transpiled code, but it only works in a single file. When I use ESM import/export syntax for cross-module inlining, it does not work.I have tried to use
rollup
to implement this, and it can work. And now I want to know if this is a bug ofVite
.Reproduction
https://stackblitz.com/edit/vitejs-vite-7lxty9
Steps to reproduce
No response
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: