fix: signal propagation

This commit is contained in:
cha0s 2023-12-01 05:34:44 -06:00
parent 1b5885623d
commit 572832b037

View File

@ -83,12 +83,15 @@ export const hooks = {
} }
// Otherwise, spawn `webpack-dev-server` (WDS). // Otherwise, spawn `webpack-dev-server` (WDS).
const cmd = [ const cmd = [
'npx', 'webpack', 'serve', // `npx` doesn't propagate signals!
// 'npx', 'webpack',
join(FLECKS_CORE_ROOT, 'node_modules', '.bin', 'webpack'),
'serve',
'--mode', 'development', '--mode', 'development',
'--hot', '--hot',
'--config', flecks.buildConfig('fleckspack.config.js'), '--config', flecks.buildConfig('fleckspack.config.js'),
]; ];
spawnWith( const child = spawnWith(
cmd, cmd,
{ {
env: { env: {
@ -96,6 +99,10 @@ export const hooks = {
}, },
}, },
); );
// Clean up on exit.
process.on('exit', () => {
child.kill();
});
// Remove the build config since we're handing off to WDS. // Remove the build config since we're handing off to WDS.
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
delete configs.web; delete configs.web;