From efcb93f8b9610bff896f21ecb5add7d17de40156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 16 Dec 2022 23:41:51 +0100 Subject: 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. --- cli/args/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cli/args/mod.rs') 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, -- cgit v1.2.3