From c9644c952536764876cff1545d2381f1bb997c34 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Mon, 27 May 2024 11:42:52 +0000 Subject: [PATCH] fix(@angular/build): disable Worker wait loop for Sass compilations in web containers The Sass Worker by default uses an Atomics-based wait loop to improve performance while waiting for messages. This loop relies on the synchronous API `receiveMessageOnPort`. While this works well in Node.js, the web container execution environment does not currently support passing transferable objects via `receiveMessageOnPort`. Closes: #27723 --- packages/angular/build/src/tools/sass/sass-service.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/angular/build/src/tools/sass/sass-service.ts b/packages/angular/build/src/tools/sass/sass-service.ts index 3d6c7a1fe80a..de48cc5602a7 100644 --- a/packages/angular/build/src/tools/sass/sass-service.ts +++ b/packages/angular/build/src/tools/sass/sass-service.ts @@ -95,6 +95,9 @@ export class SassWorkerImplementation { filename: require.resolve('./worker'), minThreads: 1, maxThreads: this.maxThreads, + // Web containers do not support transferable objects with receiveOnMessagePort which + // is used when the Atomics based wait loop is enable. + useAtomics: !process.versions.webcontainer, // Shutdown idle threads after 1 second of inactivity idleTimeout: 1000, recordTiming: false,