@Howrad wrote:
I'm building a game in Cocos Creator, and also a server. I would like to be able to do some server-side checks in Node.js by re-using a few of the JavaScript objects I wrote for the game. These are not Components, but plain vanilla JavaScript objects.
It works a little bit, until I try to use any
cc
functions. So I tried including the Cocos2D JavaScript library like this:if(typeof cc === 'undefined') require("../../build/web-desktop/cocos2d-js-min");
This fails with the error:
ReferenceError: window is not defined
Which is understandable, as Node.js doesn't have a window object. Is there a better way to do this, to include
cc
functions in a Node.js project?
Posts: 2
Participants: 2