-
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
Classes with iterators are not tree-shaken #3561
Labels
Comments
Thanks for pointing this out. That’s obviously not great, and should be safe to do. |
omar-azmi
added a commit
to omar-azmi/kitchensink_ts
that referenced
this issue
Jan 8, 2025
…ide of the `Deque` class with the `[Symbol.iterator]()` method, since esbuild can now treeshake well known symbolic methods. github issue related to this optimization: evanw/esbuild#3561
omar-azmi
added a commit
to omar-azmi/kitchensink_ts
that referenced
this issue
Jan 8, 2025
…ide of the `Deque` class with the `[Symbol.iterator]()` method, since esbuild can now treeshake well known symbolic methods. github issue related to this optimization: evanw/esbuild#3561
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When a class includes an iterator method using
Symbol.iterator
, it is no longer tree-shaken when unused.Example
If you change this to
*foo
(still a generator function), or a non-generator with a static identifier as a name, it is tree-shaken. I believe this should be safe to tree shake withSymbol.iterator
as well. SWC's minifier does so.The text was updated successfully, but these errors were encountered: