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
This commit is contained in:
Alan Agius 2024-10-09 09:06:50 +00:00 committed by Alan Agius
parent 2a1107d998
commit 549c20a939

View File

@ -334,6 +334,13 @@ export async function* serveWithVite(
ssrMode = ServerSsrMode.InternalSsrMiddleware; 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 // Setup server and start listening
const serverConfiguration = await setupServer( const serverConfiguration = await setupServer(
serverOptions, serverOptions,