From 5d6119199937b8552655745d39b075cbe4a7df6c Mon Sep 17 00:00:00 2001 From: Jacob Ley <37151850+JacobLey@users.noreply.github.com> Date: Sat, 7 Dec 2024 01:02:58 -0800 Subject: [PATCH] fix(core): defer loading package manager until necessary (#29248) --- packages/nx/src/utils/package-json.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nx/src/utils/package-json.ts b/packages/nx/src/utils/package-json.ts index 3e46cc2dff513..ea6dda74d0a66 100644 --- a/packages/nx/src/utils/package-json.ts +++ b/packages/nx/src/utils/package-json.ts @@ -177,8 +177,8 @@ export function readTargetsFromPackageJson( const { scripts, nx, private: isPrivate } = packageJson ?? {}; const res: Record = {}; const includedScripts = nx?.includedScripts || Object.keys(scripts ?? {}); - packageManagerCommand ??= getPackageManagerCommand(); for (const script of includedScripts) { + packageManagerCommand ??= getPackageManagerCommand(); res[script] = buildTargetFromScript(script, scripts, packageManagerCommand); } for (const targetName in nx?.targets) {