Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Support installed npm modules and relative require #135
Support installed npm modules and relative require #135
Changes from 16 commits
ddba1b1
f4e5d39
e853490
75e3a5b
c416f56
83c92d6
3ca4cd5
c1c139b
ade5cea
f57c84a
1f8fc98
d37f92f
7e8659d
7e12bd7
b0e12e7
01f87b6
3ede589
19e7914
4a93ad9
fb7e8f7
5ee517d
256da4e
c758586
b616178
2923e50
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concern: I feel like the order here of the
try
vs.catch
block is backwards.When using a
require('lodash')
from mygithub-script
block now, that may end up requiring an incompatible version of the module if it exists as a dependency somewhere "near" to where thegithub-script
code is executed rather than relying on the CWD'spackage.json
file. 😬There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah this is a good point. Instead, we should perhaps remove this entire try/catch construct and just do this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing in #136
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Have you tried adding
node_modules
to the path here? I think that should work, while also preventing accidental resolutions to local modules, i.e.require('hi')
=>require(process.cwd() + '/hi.js')
? 🤔There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may have mis-tested, but when I tested this, using this method did not result in the ability to
require('foo')
and have it resolve to./foo.js
. Surprisingly,module.paths.push(process.cwd())
did have this effect, but not this method.