This PR fixes originPath being a URL instead of a path.
The requireLike(…).resolve function accepts a path, but CallSite.getFileName(…) returns a URI with file:// scheme. This commit fixes the issue by removing the prefix if origin path starts with file scheme.
Since module path resolution looks for node_modules in all directories of $PWD, the issue does not arise during development. However, scripts started by npx that depend on sandboxed-module package would break with MODULE_NOT_FOUND error.
This PR fixes originPath being a URL instead of a path.
The
requireLike(…).resolve
function accepts a path, butCallSite.getFileName(…)
returns a URI withfile://
scheme. This commit fixes the issue by removing the prefix if origin path starts with file scheme.Since module path resolution looks for node_modules in all directories of $PWD, the issue does not arise during development. However, scripts started by
npx
that depend on sandboxed-module package would break with MODULE_NOT_FOUND error.