Code inside of lib/ needs to be included in both Phantom and a its simulated browser page. Phantom supports require() but the simulated page does not. This leads to weird code like this
var MODULE_NAME = (function () {
var my = {};
my.foo = function () { ... };
// etc...
if (typeof exports !== 'undefined') {
_.extend(exports, my);
}
return my;
}());
This way it uses exports if that exists, otherwise it declares a global variable for the module which a page can reference.
Code inside of
lib/
needs to be included in both Phantom and a its simulated browser page. Phantom supportsrequire()
but the simulated page does not. This leads to weird code like thisThis way it uses
exports
if that exists, otherwise it declares a global variable for the module which a page can reference.Simplify this!
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.