Earcut: Bundle earcut from source rather than copying code#30737
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
Oh interesting I missed those - thanks. It's still odd to me that this affected the CI but I don't fully understand how the e2e tests function 😅. I fixed the issue in the latest commit by limiting the limiting the node resolve plugin to just external libraries. |
|
Let's give this a try! |
|
I don't know if it's a good idea to have external dependencies in the core, could we move |
We need triangulation for shape and extrude geometry so a bunch of things would have to be moved out of core. I would like to avoid so many breaking changes, tbh.
Do we need to support this use case? |
|
I hadn't noticed the dependencies, we really have a lot here. About |
|
Given the improvements in maintainability, loosing |
|
It occurs to me that some users may still be using |
Then I vote for this option. But we have to make sure ESLint and stuff like DeepScan ignore the file. Maybe we can place the code in |



Related issue: #30698 (comment)
Description
Removes the copied earcut code and adds earcut as a dev dependency. The earcut code is still bundled into the final three.js distribution files so "three" still has no dependencies. This makes it easier to update the earcut algorithm from upstream.
If needed we can "fix" the earcut version so it doesn't automatically update on patch or minor changes.