From 0c4462f5fd62e0721b8d43c4d4a1f5f07ace7a70 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 ec3ddbb84cd8..b55ac9e6e599 100644 --- a/packages/angular/build/src/builders/dev-server/vite-server.ts +++ b/packages/angular/build/src/builders/dev-server/vite-server.ts @@ -96,6 +96,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