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/tools/repl/session.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/tools/repl/session.rs')
-rw-r--r-- | cli/tools/repl/session.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cli/tools/repl/session.rs b/cli/tools/repl/session.rs index f67396d42..3f6528f3b 100644 --- a/cli/tools/repl/session.rs +++ b/cli/tools/repl/session.rs @@ -456,7 +456,11 @@ impl ReplSession { if !npm_imports.is_empty() { if !self.has_initialized_node_runtime { self.proc_state.prepare_node_std_graph().await?; - crate::node::initialize_runtime(&mut self.worker.js_runtime).await?; + crate::node::initialize_runtime( + &mut self.worker.js_runtime, + self.proc_state.options.node_modules_dir(), + ) + .await?; self.has_initialized_node_runtime = true; } |