Skip to content

Commit 9c1e017

Browse files
committed
fix: gracefull shutdown on watch/cache
1 parent f407b24 commit 9c1e017

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/webpack-cli/src/webpack-cli.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2484,18 +2484,22 @@ class WebpackCLI implements IWebpackCLI {
24842484

24852485
compiler = await this.createCompiler(options as WebpackDevServerOptions, callback);
24862486

2487-
if (!compiler) {
2488-
return;
2489-
}
2487+
if (!compiler) return;
24902488

24912489
const isWatch = (compiler: WebpackCompiler): boolean =>
24922490
Boolean(
24932491
this.isMultipleCompiler(compiler)
24942492
? compiler.compilers.some((compiler) => compiler.options.watch)
24952493
: compiler.options.watch,
24962494
);
2495+
const isCacheEnabled = (compiler: WebpackCompiler): boolean =>
2496+
Boolean(
2497+
this.isMultipleCompiler(compiler)
2498+
? compiler.compilers.some((compiler) => compiler.options.cache)
2499+
: compiler.options.cache,
2500+
);
24972501

2498-
if (isWatch(compiler)) {
2502+
if (isWatch(compiler) || isCacheEnabled(compiler)) {
24992503
let needForceShutdown = false;
25002504

25012505
for (const signal of EXIT_SIGNALS) {

0 commit comments

Comments
 (0)