From 549c20a9396b33ae2e6708a8a9a7c77f0167b276 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 9 Oct 2024 09:06:50 +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 91ce9cc85554..0a059ce53fc8 100644 --- a/packages/angular/build/src/builders/dev-server/vite-server.ts +++ b/packages/angular/build/src/builders/dev-server/vite-server.ts @@ -334,6 +334,13 @@ export async function* serveWithVite( ssrMode = ServerSsrMode.InternalSsrMiddleware; } + if (browserOptions.progress !== false && ssrMode !== ServerSsrMode.NoSsr) { + // 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); + }); + } + // Setup server and start listening const serverConfiguration = await setupServer( serverOptions,