pmndrs / drei

🥉 useful helpers for react-three-fiber
https://drei.pmnd.rs/
MIT License
7.83k stars 642 forks source link

Support Three.js tree-shaking #2006

Closed pedroalmeida415 closed 1 week ago

pedroalmeida415 commented 1 week ago

Describe the feature you'd like:

Currently, import * as THREE from 'three' is used throughout the project, which always forces the entire Three.js package to be bundled with your app when using Drei.

Suggested implementation:

Replace import * as THREE from 'three' statements with named imports:

-  import * as THREE from 'three';
+  import { dependency1, dependency2, dependency3... } from 'three';
pedroalmeida415 commented 1 week ago

The problem was actually in the analyzing tool I was using.