yushijinhun/three-minifier

Resolve three / three/build/three.module.js to three/src/Three.js.

Closed this issue · 1 comments

This makes it possible for bundlers to perform better tree-shaking.
what is this?

Three.js bundles all its modules in src/ into a single file three.module.js. If you want to use three.js, you have to import the whole library, even if you are just using some parts of it.

Most bundlers support a technique called tree-shaking, which will exclude unused modules when bundling. However, this doesn't work well with three.js, because all its code is in a single module three.module.js. The solution is to use modules in src/ instead of the bundled one. Three-minifier replaces three or three/build/three.module.js with three/src/Three.js, so no matter how you import three.js, you always use modules from src/.