-
-
Notifications
You must be signed in to change notification settings - Fork 35.8k
Tree-shaking not working with ESBuild #25855
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
Comments
I was looking through the tree-shaking issue, and I found this comment: #24199 (comment). The solution to change the import from |
Following the discussion it seems the "importing
Closing this issue as |
I would be cautious with this workaround – addons like loaders and controls also import from 'three', so it's easy to end up with multiple copies of three.js in your codebase. Support for the missing tree-shaking features in ESBuild can be tracked in the issue below. As @Mugen87 mentions, this isn't something we plan to change in the meantime. |
Description
I'm trying to use treeshaking, (aka
import { Vector2 } from 'three';
) with esbuild, but it isn't working, instead it's pulling in all ofthree.module.js
.Reproduction steps
Vector2
fromthree
npx esbuild index.js --bundle --outfile=bundle.js
Code
I made a small reproduction repo: https://github.com/TesseractCat/three-esbuild-tree-shaking-broken
Live example
N/A
Screenshots
No response
Version
^0.151.3
Device
Desktop
Browser
Chrome, Firefox
OS
Windows, Linux
The text was updated successfully, but these errors were encountered: