-
Notifications
You must be signed in to change notification settings - Fork 174
Closed
Description
I'm trying to export a glTF scene from ngl. I tried simply adding GLTFExporter to the three import list in viewer.ts, and tried a few other ways as well, but I can't get it to build with GLTFExporter.
I know GLTFExporter has some typescript problems, but I've managed to import it and use it in a simple test typescript project like this:
// just for GLTFExporter
import * as THREE from 'three'
(<any>window).THREE = THREE; // need to make this global
import 'three/examples/js/exporters/GLTFExporter';
and then to use it:
let exporter = new THREE.GLTFExporter()
exporter.parse(scene, (gltf) => {console.log("Parsed scene!"); }, {});
which works in the test project but not in ngl. In ngl if I add the above code to viewer.ts, I get this error when building:
(!) Missing exports
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
build\js\src\viewer\viewer.js
GLTFExporter is not exported by node_modules\three\build\three.module.js
(which is true; it just adds it to THREE), and at runtime in the browser console:
Uncaught ReferenceError: THREE is not defined
at GLTFExporter.js:54
at window.console (ngl.dev.js:4)
at ngl.dev.js:5
Note that THREE is only defined in viewer.ts by my code above. I'm not sure what the above error means.
Metadata
Metadata
Assignees
Labels
No labels