I麓m using three.js in an Angular project with webpack as bundler.
When trying to load a GLTF file a ReferenceError is thrown:
ERROR Error: Uncaught (in promise): ReferenceError: THREE is not defined
ReferenceError: THREE is not defined at GLTFLoader.js:2715
Referring to this line of code:
In my TypeScript code, I import the loader this way:
import { GLTFLoader} from 'three/examples/jsm/loaders/GLTFLoader';
I guess to fix this, either _BufferGeometryUtils_ hast to be exported in _three.module.js_ or the code block has to be removed from the jsm version of GLTFLoader, as the global _THREE_ object is not defined.
I also found that _BufferGeometryUtils_ is an exception in the _modularize_ script:
Unfortunately the examples/jsm
modules aren't fully functional yet sorry. Still working on this.
An other user reported the same problem here:
Merging #15582 should solve this issue, right?
I麓ve tryed the updated GLTFLoader in dev branch and it麓s working fine, waiting for the release.
Thanks for the fix!
For anyone that needs an urgent fix, use the 'three-gltf-loader' npm package:
import GLTFLoader from 'three-gltf-loader';
Most helpful comment
I麓ve tryed the updated GLTFLoader in dev branch and it麓s working fine, waiting for the release.
Thanks for the fix!
For anyone that needs an urgent fix, use the 'three-gltf-loader' npm package:
import GLTFLoader from 'three-gltf-loader';