summaryrefslogtreecommitdiff
path: root/cli/tools/task.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-01-08 19:30:36 -0500
committerGitHub <noreply@github.com>2024-01-08 19:30:36 -0500
commitbe888c068cbe42c1cb93d9885827dc97aa40d6f6 (patch)
tree038de43014e22006a7fd4bbed97c4843bbebd087 /cli/tools/task.rs
parent0efb17b2cbd326abec1a053fb0eb81ce5c881eea (diff)
fix(task): do not eagerly auto-install packages in package.json when `"nodeModulesDir": false` (#21858)
There's no need to auto-install the package.json if the user is not using a node_modules directory. Closes #21850
Diffstat (limited to 'cli/tools/task.rs')
-rw-r--r--cli/tools/task.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/cli/tools/task.rs b/cli/tools/task.rs
index ffeea7460..dfb0c585e 100644
--- a/cli/tools/task.rs
+++ b/cli/tools/task.rs
@@ -88,10 +88,13 @@ pub async fn execute_script(
}
}
- // install the npm packages if we're using a managed resolver
- if let Some(npm_resolver) = npm_resolver.as_managed() {
- npm_resolver.ensure_top_level_package_json_install().await?;
- npm_resolver.resolve_pending().await?;
+ // ensure the npm packages are installed if using a node_modules
+ // directory and managed resolver
+ if cli_options.has_node_modules_dir() {
+ if let Some(npm_resolver) = npm_resolver.as_managed() {
+ npm_resolver.ensure_top_level_package_json_install().await?;
+ npm_resolver.resolve_pending().await?;
+ }
}
let cwd = match task_flags.cwd {