peterqliu / threebox

A three.js plugin for Mapbox GL JS, with support for basic animation and advanced 3D rendering.
MIT License
525 stars 320 forks source link

ES Module (ESM) version of threebox #75

Open danvk opened 5 years ago

danvk commented 5 years ago

As of r106 ES modules are the preferred way to use THREE.js. I'd like to import THREE.js in my own code as an ES module, but threebox uses its own bundled version of three.js, which I imagine will cause issues.

It would be great if threebox used the ESM version of THREE.js rather than bundling its own. Or, alternatively, gave the user some way to bring your own THREE.js.

peterpolman commented 5 years ago

There is a way to change the baked in three.js version; Try to replace the ./src/three.js file with a version of your choice and run the build command as defined in ./package.json.

npm run build

This will compile a new minified threebox file containing your specified three.js version. You can require this in your app. Beware for conflicts when you upgrade three.js in threebox, the threebox code might not be ready for the latest three.js changes:)

danvk commented 5 years ago

That's not usually how dependencies are handled with NPM :) It would be better if threebox declared its dependency on three.js, rather than bundling it. This would let my app and threebox share a common version.

peterpolman commented 5 years ago

I know. But you asked for a way to bring your own three.js version. This is a way:)

On Fri, 4 Oct 2019 at 00:50, Dan Vanderkam notifications@github.com wrote:

That's not usually how dependencies are handled with NPM :) It would be better if threebox declared its dependency on three.js, rather than bundling it. This would let my app and threebox share a common version.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/peterqliu/threebox/issues/75?email_source=notifications&email_token=AASEXRZF7ZC7ZGETZDZYM7LQMZZJTA5CNFSM4I42Z232YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAJ2NUY#issuecomment-538158803, or mute the thread https://github.com/notifications/unsubscribe-auth/AASEXR2Q2VVTLVJTXHVNGC3QMZZJTANCNFSM4I42Z23Q .