Skip to content
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

More node-ish require support #87

Open
maxkorp opened this issue Mar 20, 2015 · 1 comment
Open

More node-ish require support #87

maxkorp opened this issue Mar 20, 2015 · 1 comment

Comments

@maxkorp
Copy link

maxkorp commented Mar 20, 2015

I know the module works with require, but do you have any thoughts on supporting node style require over just commonjs?
Currently, works like so

var x = require('keypress.js') // from NPM module, it's published as keypress.js instead of keypres
x.keypress // The module

Whats more typical for node modules is like so

var x = require('keypress.js');
x; // The module

In my experience just from browsing through other projects, it seems that people give prevalence to module.exports if it's available, and fall back to just exports when thats available. If that's a palatable solution, I'd be happy to submit a PR. This is hardly a breaking thing either way, just a nice convenience bit.

Alternatively, I could convert it to UMD.

Either way, it's a breaking change by default (since anybody in a node environment would be expecting requiredvar.keypress, not just requiredvar. We could also shortcut that though, so it would continue working.

@dmauro
Copy link
Owner

dmauro commented Aug 16, 2015

Sorry for the super late response. If you'd like to submit a PR that would be great. It sounds like you know more about this particular case than I do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants