I’m new to Cocos2d-js and have been trying to use Node.js modules within my project, but have come across some challenges.
I’ve created the node_modules directory (with the correct modules installed within it) and the package.json file and placed these within the src folder containing app.js and resource.js files.
Now when i try to instantiate the module within app.js:
var Module = require(‘module’);
var module = new Module();
I get a “Module is not a constructor” error.
I feel it has something to do with the “project.json” file and having this node_modules folder included in there but i’m not sure how that should be done.
Any help on this would be greatly appreciated!