-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Math is a side-effect #3988
Comments
I that in fact it constant-folds and tree-shakes the first constant (in a file?) but does not continue doing that for subsequent constants.
|
Bonus discovery - it works when the expression is It just fails for |
@thetarnav Your playground works OK if you add When minifying, esbuild will perform constant-folding, reducing your However, per my comments, this doesn't happen for |
My issue is mainly about |
I think constant-folding even when |
constants with math operations are not being tree-shaken
INPUT
OUTPUT
https://esbuild.github.io/try/#YgAwLjI0LjAALS1idW5kbGUgLS1mb3JtYXQ9ZXNtAGUAZW50cnkuanMAY29uc3QgRk9PID0gMSArIDI
Which in my case leaves a bunch of unused constants from imported but unused libraries.
CODE
And there is no way to prevent this without making them to an iife afaik.
The text was updated successfully, but these errors were encountered: