I am using THREE js
importing the library like this
import THREE from 'three';
no problem. but the Stats library they use with the code is not included in the module so
import Stats from 'three/examples/js/libs/stats.min.js';
This works too! Example code that extends the library is also not included in the module, like OrbitControls
So when I try importing that one
import OrbitControls from'three/examples/js/controls/OrbitControls.js';
it Fails. with Uncaught ReferenceError: THREE is not defined
Orbit controls simply extends on the THREE object like this:
THREE.OrbitControls = function ( object, domElement ) {
//...code
}
So it expects a THREE object that does not exist in its scope
How could I fix this? is there a way to pass arguments to imports