Skip to content

Commit

Permalink
fix(@angular/build): disable Worker wait loop for Sass compilations i…
Browse files Browse the repository at this point in the history
…n 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
(cherry picked from commit c9644c9)
  • Loading branch information
alan-agius4 committed May 28, 2024
1 parent de8d703 commit 3bb06c3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/angular/build/src/tools/sass/sass-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 3bb06c3

Please sign in to comment.