-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Examples: convert Utils files to esmodules #22284
Conversation
Thanks! |
Hi @marcofugaro, would you like to share any idea why this way can help with tree shaking? I am not sure about the difference under the hood and i am curious about it.
|
@MickeyMiao7 basically, class methods are not tree-shakeable by bunders, while es-style exports are. There was no point in putting just functions under a class without using any of the class local state, so they've been converted to plain functions. You can see an example of it in this short guide: https://esbuild.github.io/api/#tree-shaking |
@marcofugaro Thanks you so much! |
Related issue: #22267
Description
I converted all
*Utils
files in the examples to esmodules to allow for tree-shaking. They now need to be imported like this:The files I touched are
NURBSUtils
,CameraUtils
,SceneUtils
,GeometryCompressionUtils
,GeometryUtils
,SkeletonUtils
.I had to move
PackedPhongMaterial
out ofGeometryCompressionUtils
as well.