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

require hook is only usable in development? #27

Closed
nfcampos opened this issue Oct 7, 2016 · 4 comments
Closed

require hook is only usable in development? #27

nfcampos opened this issue Oct 7, 2016 · 4 comments

Comments

@nfcampos
Copy link

nfcampos commented Oct 7, 2016

due to this line https://github.com/leebyron/async-to-gen/blob/master/register.js#L9 the require hook only works in development since if a package is installed from npm it will most likely contain node_modules in its path.
is this on purpose?
if so, then maybe a line should be added to the readme alerting people to this.

@leebyron
Copy link
Owner

leebyron commented Oct 7, 2016

This is on purpose as packages distributed on npm are intended to be used in node without any additional runtime. You should use async-to-gen to produce the compiled artifacts to distribute on npm.

Require hooks are only for development use. They introduce an overhead typically deemed unacceptable for production use. You should typically only deploy compiled files

@leebyron leebyron closed this as completed Oct 7, 2016
@leebyron
Copy link
Owner

leebyron commented Oct 7, 2016

Just added a note to the readme about this! Thanks for the recommendation

@nfcampos
Copy link
Author

nfcampos commented Oct 7, 2016

Thanks! I was trying to use it in production for a small CLI tool, which is why i wasn't worried that it would affect the whole runtime, seeing as it wasn't meant to ever be imported. but anyway it wasn't that much of a pain to set up a build step ;)

@raphaelokon
Copy link

raphaelokon commented Nov 4, 2016

Same here … that tripped me on the patternlab-node-cli. Just adding the build step ^^
Cheers on this great package tho.

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

No branches or pull requests

3 participants