We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This was a point raised in #786. We can prevent require()ing files with:
require()
if (require.main === module) { // everything goes here }
This might be a good idea for files which we only intend to execute (e.g. bin/shjs).
bin/shjs
I would also consider rewriting as:
if (require.main !== module) { throw new Error('Module should not be required'); } // everything goes here
The text was updated successfully, but these errors were encountered:
Failing loudly sounds like a good behavior. That way, you can't even accidentally require the file without node exiting.
Sorry, something went wrong.
freitagbr
No branches or pull requests
This was a point raised in #786. We can prevent
require()
ing files with:This might be a good idea for files which we only intend to execute (e.g.
bin/shjs
).I would also consider rewriting as:
The text was updated successfully, but these errors were encountered: