yabble icon indicating copy to clipboard operation
yabble copied to clipboard

Add support for modules that redefine module.exports

Open danieldickison opened this issue 14 years ago • 0 comments

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).

danieldickison avatar Aug 24 '11 18:08 danieldickison