mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
fix(ext/node): fix npm module resolution when --node-modules-dir specified (#17896)
This commit is contained in:
parent
38f9aa0f9c
commit
6de815859b
3 changed files with 11 additions and 4 deletions
|
@ -660,6 +660,13 @@ itest!(deno_run_cowsay {
|
|||
http_server: true,
|
||||
});
|
||||
|
||||
itest!(deno_run_cowsay_with_node_modules_dir {
|
||||
args: "run -A --quiet --node-modules-dir npm:cowsay@1.5.0 Hello",
|
||||
output: "npm/deno_run_cowsay.out",
|
||||
envs: env_vars_for_npm_tests_no_sync_download(),
|
||||
http_server: true,
|
||||
});
|
||||
|
||||
itest!(deno_run_cowsay_explicit {
|
||||
args: "run -A --quiet npm:cowsay@1.5.0/cowsay Hello",
|
||||
output: "npm/deno_run_cowsay.out",
|
||||
|
|
1
cli/tests/testdata/.gitignore
vendored
Normal file
1
cli/tests/testdata/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
node_modules
|
|
@ -371,10 +371,9 @@ Module._findPath = function (request, paths, isMain, parentPath) {
|
|||
const isRelative = ops.op_require_is_request_relative(
|
||||
request,
|
||||
);
|
||||
const basePath =
|
||||
(isDenoDirPackage && !isRelative && !usesLocalNodeModulesDir)
|
||||
? pathResolve(curPath, packageSpecifierSubPath(request))
|
||||
: pathResolve(curPath, request);
|
||||
const basePath = (isDenoDirPackage && !isRelative)
|
||||
? pathResolve(curPath, packageSpecifierSubPath(request))
|
||||
: pathResolve(curPath, request);
|
||||
let filename;
|
||||
|
||||
const rc = stat(basePath);
|
||||
|
|
Loading…
Reference in a new issue