karfau / runex

Run (javascript) module export as a script
MIT License
1 stars 1 forks source link

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

Closed karfau closed 4 years ago

karfau commented 4 years ago

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 commented 4 years ago

@saurabh2590 this solves the problem we had recently