yabble
yabble copied to clipboard
Add support for modules that redefine module.exports
Add support for modules that redefine module.exports which is common with node libraries. For example, if the module does:
module.exports = function () {...}
Then the client code can do:
require('foo')(args)
For example, here's a UUID library that uses this idiom: https://github.com/broofa/node-uuid
I believe pull request 6 is trying to achieve the same effect, but it breaks compatibility with CommonJS Modules/1.1 as the module object doesn't have the url or id properties.
This patch maintains compatibility with Modules/1.1, although it still breaks the requirement that "modules must use the "exports" object as the only means of exporting." (emphasis added).