You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am building a library that depends on three.js v128. Rather than making the users add the three.js dependency themselves, I sought to conditionally add it within the UMD script. However, in order for this to work, I have to first load three.js and only then run the library. I therefore tried to do the following:
// ... code to conditionally load three.js v128
import('./path/to/my/three.js/stuff').then(ThreejsScene => {
threejsScene = new ThreejsScene.ThreejsScene();
threejsScene.init();
});
... this works in development environment BUT when I try to build a UMD it gives me an error due to wanting to output multiple chunks. But I don't want multiple chunks -- I want to keep a single file UMD, the only reason for the relative import being that I need to first ensure that three.js v128 is loaded and only then load stuff that depends on there being a gloabl variable THREE.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am building a library that depends on three.js v128. Rather than making the users add the three.js dependency themselves, I sought to conditionally add it within the UMD script. However, in order for this to work, I have to first load three.js and only then run the library. I therefore tried to do the following:
... this works in development environment BUT when I try to build a UMD it gives me an error due to wanting to output multiple chunks. But I don't want multiple chunks -- I want to keep a single file UMD, the only reason for the relative import being that I need to first ensure that three.js v128 is loaded and only then load stuff that depends on there being a gloabl variable THREE.
Is what am I trying to do possible?
Beta Was this translation helpful? Give feedback.
All reactions