From 9445916f9b5b9da69623bf86735264d8a5f26fb3 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 9 Oct 2024 11:43:38 +0000 Subject: [PATCH] fix(@angular/build): `Ctrl + C` not terminating dev-server with SSR This commit provides a workaround for https://github.com/angular/angular-cli/issues/28336, which occurs due to the interaction between `zone.js` and `listr2`. The issue prevents proper termination of the development server using Ctrl + C when dev-server. Closes: #28336 --- .../angular/build/src/builders/dev-server/vite-server.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/angular/build/src/builders/dev-server/vite-server.ts b/packages/angular/build/src/builders/dev-server/vite-server.ts index f1864fda1a21..f6a4f54accd2 100644 --- a/packages/angular/build/src/builders/dev-server/vite-server.ts +++ b/packages/angular/build/src/builders/dev-server/vite-server.ts @@ -101,6 +101,13 @@ export async function* serveWithVite( // https://nodejs.org/api/process.html#processsetsourcemapsenabledval process.setSourceMapsEnabled(true); + + if (browserOptions.progress !== false) { + // This is a workaround for https://github.com/angular/angular-cli/issues/28336, which is caused by the interaction between `zone.js` and `listr2`. + process.once('SIGINT', () => { + process.kill(process.pid); + }); + } } // Set all packages as external to support Vite's prebundle caching