box2d.js
box2d.js copied to clipboard
Errors in Node.js environment
There are some issues with using box2d.js in a Node.js environment:
- it's not exported as Node.js module
- Mocha detects
Error: global leak detected: Module
The fixes are easy, but I have no idea where to put them:
- replace
Module;withvar Module;somewhere - add
module.exports = Module;at the end of the file
Cheers, Chris
I fiddled around a bit and came up with the following solution:
/*
* https://github.com/kripken/box2d.js
*
* box2d.js is zlib licensed, just like Box2D.
*/
// ... COMPILED ONE LINER GOES HERE ...
module.exports = this.Box2D;
Edit: Adding --globals Module to mocha's command line seems cleaner for now.