diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-12-16 23:41:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-16 23:41:51 +0100 |
commit | efcb93f8b9610bff896f21ecb5add7d17de40156 (patch) | |
tree | b8805ba050821a8cdfc2a9305587556afdc638af /cli/args/mod.rs | |
parent | 058610b458bfbc361f9a4bef62152465bf72d2c3 (diff) |
fix(npm): fix require resolution if using --node-modules-dir (#17087)
In our `require()` implementation we use a special logic to resolve
"base path" when looking for matching packages, however this logic
is in contradiction to what needs to happen if there's a local
"node_modules"
directory used. This commit changes require implementation to be aware
if we're running off of global node modules cache or a local one.
Diffstat (limited to 'cli/args/mod.rs')
-rw-r--r-- | cli/args/mod.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cli/args/mod.rs b/cli/args/mod.rs index de5725a48..f936f9c25 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -280,6 +280,10 @@ impl CliOptions { self.overrides.import_map_specifier = Some(path); } + pub fn node_modules_dir(&self) -> bool { + self.flags.node_modules_dir + } + /// Resolves the path to use for a local node_modules folder. pub fn resolve_local_node_modules_folder( &self, |