mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 18:38:33 +00:00
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.
This commit is contained in:
parent
058610b458
commit
efcb93f8b9
5 changed files with 35 additions and 9 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue