Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was working on unconed/mathbox#49 and realized we should do the same for this library
What does this do
Previously we were importing from specific three/src files. Now we just import from
"three"
.Why change? Because:
1. we can still tree shake
2. we were actually (indirectly) using bare imports before, too. E.g., ThreeStrap imports from "three/examples/jsm/controls/OrbitControls", and OrbitControls imports bare "three"
3. "three" seems like the more official import pattern; it's what is documented at https://threejs.org/docs/#manual/en/introduction/Installation
Related
See also unconed/mathbox#49
Some numbers
I was not expecting this to affect bundle sizes very significantly, but it actually did reduce the bundle size pretty significantly, at least for webpack, I think because of (2) above: previously we were including
three/src
directly, andthree/build
indirectly (via imports likethree/examples/jsm/controls/OrbitControls
).I published a version of threestrap on npm that includes this change,
v0.5.1-rc1
and testing with https://github.com/ChristopherChudzicki/bundling-tests:So, that's cool.