From b1e5f51f9111d7da56ebe64cad51936ad659782d Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 23 Oct 2024 07:54:27 +0000 Subject: [PATCH] fix(@angular/build): Address build issue in Node.js LTS versions with prerendering or SSR In Node.js 20, changes to ESM loader hooks result in the `--import` execArgv being passed from the parent to child workers. This commit resolves the issue by setting an empty `execArgv` in the JavaScript transformer, preventing unintended propagation. Closes #28683 (cherry picked from commit cc345b02d814a37bb23d6c3f1baca9595130d010) --- .../angular/build/src/tools/esbuild/javascript-transformer.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/angular/build/src/tools/esbuild/javascript-transformer.ts b/packages/angular/build/src/tools/esbuild/javascript-transformer.ts index ce4b0aa91356..08d8efd4e94a 100644 --- a/packages/angular/build/src/tools/esbuild/javascript-transformer.ts +++ b/packages/angular/build/src/tools/esbuild/javascript-transformer.ts @@ -62,6 +62,8 @@ export class JavaScriptTransformer { // Shutdown idle threads after 1 second of inactivity idleTimeout: 1000, recordTiming: false, + // Prevent passing `--import` (loader-hooks) from parent to child worker. + execArgv: [], }); return this.#workerPool;