nudibranchrecords / hedron

Perform live shows with your three.js creations
GNU Affero General Public License v3.0
481 stars 22 forks source link

[WIP] Hedron dependency exports #468

Open funwithtriangles opened 2 weeks ago

funwithtriangles commented 2 weeks ago

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:

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