Closed Mugen87 closed 5 years ago
Hi Michael. You can import tween.js after adding this line to the end of Tween.js:
export {TWEEN};
I plan to add a script that will do this for you and place the result in tween.es6.js. I also plan to have this done automatically by the CI.
On Fri, Jun 21, 2019 at 2:14 AM Michael Herzog notifications@github.com wrote:
We are using tween.js in several three.js demos e.g. css3d_periodictable https://threejs.org/examples/css3d_periodictable. The example code is currently migrated to ES6 modules and it would be great if also external libraries like tween.js can be included via ES6 imports. So something like:
import TWEEN from
./path/to/our/tween.module.js
;— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tweenjs/tween.js/issues/459?email_source=notifications&email_token=AAQJVP7BBJNPRH5RGKUIIWLP3SLX5A5CNFSM4H2PHPCKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G25IQEQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAQJVP3FJUEE5K6ZY3TMYM3P3SLX5ANCNFSM4H2PHPCA .
I plan to add a script that will do this for you and place the result in tween.es6.js. I also plan to have this done automatically by the CI.
Sounds good! Definitely better than doing a manual modification.
This actually works:
import TWEEN from '@tweenjs/tween.js'
To use tween.js as an ES6 module follow these steps:
npm i @tweenjs/tween.js
npm run build
dist/tween.esm.js
somewhereimport TWEEN from './js/tween.esm.js';
We are using
tween.js
in severalthree.js
demos e.g. css3d_periodictable. The example code is currently migrated to ES6 modules and it would be great if also external libraries liketween.js
can be included via ES6 imports. So something like: