In Cocos Creator v1.4, I was importing this file just fine in my other source files. But once upgraded to Cocos Creator v1.4.2, the editor keeps throwing me this error:
TypeError: Cannot read property 'module' of undefined
at Object.require.behavior3js: "if (typeof module !== 'undefined' && this.module !== module) {" (assets/src/lib/behavior3js.js:2)
How can I fix this error? Why is ‘this’ undefined?
I actually re-loaded my project n another instance of Cocos Creator v1.4.0, and this time it threw me the same ‘TypeError: Cannot read property ‘module’ of undefined’ type error.
Now, it’s a mystery to me why it worked in the previous CC v1.4.0 before…
However, I am kinda short on time at the moment so can’t look into it. I solved the error by simply changing the script to:
if (typeof module !== 'undefined' && module.exports) {
var b3 = {};