Question

Hey guys i got a question, when i wanna use SceneExporter in node.js i got some problem with require it i will show examples:

THREE = require 'three' - here i include module which i instaled to node.js
Export = require './SceneExporter.js'  -  here is js

ERROR: THREE.SceneExporter = function () {}; ^ ReferenceError: THREE is not defined

How can i use it in node.js ?

Maybe some 1 here did it before.

What's more when i try include three.js from file like here:

THREE = require './three.js'

I get other error:

/home/name/NetBeansProjects/SerwerNode/src/three.js:26561
self._typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.
^
ReferenceError: self is not defined
Was it helpful?

Solution

I assume you use this bundle of three.js https://github.com/nulltask/node-three.js

Well, it won't solve your problem, but to the question "Why you can't require SceneExporter ?"

the answer is "because this bundle either is not up-to-date with the original repository or it simply does not include the SceneExporter class"

So, what is best approach to solve your dependency problem ? I don't have the answer yet, but you should keep an eye on the relevant three.js issue here: https://github.com/mrdoob/three.js/issues/4776

OTHER TIPS

Because node.js does not support window/self, which are Web APIs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top