Not sure if this is the best approach but I've done a lot of fiddling today around this issue. Currently our example project is importing three from various sources. This causes a warning in the console and I can imagine takes up unnecessary resources loading the same JS multiple times. There are 4 places three.js could be loaded from:
Hedron's instance
Sketch: imported from three
Sketch: imported from three/examples/whatever
Sketch: imported from postprocessing
This PR brings it all together under window.HEDRON.dependencies. Unfortunately it's a bit clunky for the user (and a bit of work to get it typed nicely). These globals come from @hedron/engine, although I'm not sure if that's going to be so great for web projects, because it's relying on three-stdlib and i'm not sure if that will be properly tree-shaked.
⚠️ NOTE: This PR is merging into monorepo and shouldn't be merged until that's all sorted
Not sure if this is the best approach but I've done a lot of fiddling today around this issue. Currently our example project is importing
three
from various sources. This causes a warning in the console and I can imagine takes up unnecessary resources loading the same JS multiple times. There are 4 places three.js could be loaded from:three
three/examples/whatever
postprocessing
This PR brings it all together under
window.HEDRON.dependencies
. Unfortunately it's a bit clunky for the user (and a bit of work to get it typed nicely). These globals come from@hedron/engine
, although I'm not sure if that's going to be so great for web projects, because it's relying onthree-stdlib
and i'm not sure if that will be properly tree-shaked.⚠️ NOTE: This PR is merging into
monorepo
and shouldn't be merged until that's all sorted