Skip to content

Commit d5348bd

Browse files
committed
fix(@angular-devkit/build-webpack): properly shutdown webpack 5 compilation
This change ensures that the compiler instance is used when closing the compiler.
1 parent c322a29 commit d5348bd

File tree

1 file changed

+3
-4
lines changed
  • packages/angular_devkit/build_webpack/src/webpack

1 file changed

+3
-4
lines changed

packages/angular_devkit/build_webpack/src/webpack/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,9 @@ export function runWebpack(
5454
return createWebpack({ ...config, watch: false }).pipe(
5555
switchMap(webpackCompiler => new Observable<BuildResult>(obs => {
5656
// Webpack 5 has a compiler level close function
57-
// The close function will crash if caching is disabled
58-
const compilerClose = webpackCompiler.options.cache !== false
59-
? (webpackCompiler as { close?(callback: () => void): void }).close
60-
: undefined;
57+
const compilerClose = (webpackCompiler as { close?(callback: () => void): void }).close?.bind(
58+
webpackCompiler,
59+
);
6160

6261
const callback = (err?: Error, stats?: webpack.Stats) => {
6362
if (err) {

0 commit comments

Comments
 (0)