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

fix(--require): Resolve project local modules in npx context #49

Merged
merged 1 commit into from
Apr 10, 2020

Conversation

karfau
Copy link
Owner

@karfau karfau commented Apr 10, 2020

When executing a local TypeScript module and using --require=ts-node/register option,
node was trying to resolve it inside the temporary npx folder.
This behaviour doesn't currently make sense, now modules required via this option
are always resolved relative from the current working directory of the script.
This currently prevents requiring a module that only exists in the npx context, but that could be added back easily if needed.

https://nodejs.org/docs/latest-v10.x/api/all.html#modules_require_resolve_request_options

When executing a local TypeScript module and using `--require=ts-node/register` option,
node was trying to resolve it inside the temporary npx folder.
This behaviour doesn't currently make sense, now modules required via this option
are always resolved relative from the current working directory of the script.
This currently prevents requiring a module that only exists in the npx context, but that could be added back easily if needed.

https://nodejs.org/docs/latest-v10.x/api/all.html#modules_require_resolve_request_options
@karfau karfau added the bug Something isn't working label Apr 10, 2020
@karfau
Copy link
Owner Author

karfau commented Apr 10, 2020

@saurabh2590 this solves the problem we had recently

@karfau karfau merged commit 2603649 into master Apr 10, 2020
@karfau karfau deleted the fix/local-require branch April 10, 2020 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant