From d1b7b3142cfe820b7c871a912d85ad72c91bfc52 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Tue, 3 Oct 2023 15:33:29 -0400 Subject: [PATCH] fix(core): cache runtime hashes with the env as part of the key (#19426) --- packages/nx/src/hasher/task-hasher.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/nx/src/hasher/task-hasher.ts b/packages/nx/src/hasher/task-hasher.ts index 91e5370ba9602..1c8afed83bd52 100644 --- a/packages/nx/src/hasher/task-hasher.ts +++ b/packages/nx/src/hasher/task-hasher.ts @@ -744,7 +744,9 @@ class TaskHasherImpl { } private async hashRuntime(runtime: string): Promise { - const mapKey = `runtime:${runtime}`; + const env = getHashEnv(); + const env_key = JSON.stringify(env); + const mapKey = `runtime:${runtime}-${env_key}`; if (!this.runtimeHashes[mapKey]) { this.runtimeHashes[mapKey] = new Promise((res, rej) => { exec( @@ -752,7 +754,7 @@ class TaskHasherImpl { { windowsHide: true, cwd: workspaceRoot, - env: getHashEnv(), + env, }, (err, stdout, stderr) => { if (err) {