Skip to content

Add support for modules that redefine module.exports #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

danieldickison
Copy link

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 and others added 3 commits August 24, 2011 14:04
…with node libraries.

For example, if the module does:
    module.exports = function () {...}
Then the client code can do:
    require('foo')(args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant