diff options
Diffstat (limited to 'cli/node/mod.rs')
-rw-r--r-- | cli/node/mod.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cli/node/mod.rs b/cli/node/mod.rs index 64e08becb..190f386a7 100644 --- a/cli/node/mod.rs +++ b/cli/node/mod.rs @@ -391,14 +391,19 @@ static RESERVED_WORDS: Lazy<HashSet<&str>> = Lazy::new(|| { pub async fn initialize_runtime( js_runtime: &mut JsRuntime, + uses_local_node_modules_dir: bool, ) -> Result<(), AnyError> { let source_code = &format!( - r#"(async function loadBuiltinNodeModules(moduleAllUrl, nodeGlobalThisName) {{ + r#"(async function loadBuiltinNodeModules(moduleAllUrl, nodeGlobalThisName, usesLocalNodeModulesDir) {{ const moduleAll = await import(moduleAllUrl); Deno[Deno.internal].node.initialize(moduleAll.default, nodeGlobalThisName); - }})('{}', '{}');"#, + if (usesLocalNodeModulesDir) {{ + Deno[Deno.internal].require.setUsesLocalNodeModulesDir(); + }} + }})('{}', '{}', {});"#, MODULE_ALL_URL.as_str(), NODE_GLOBAL_THIS_NAME.as_str(), + uses_local_node_modules_dir, ); let value = |