Skip to content

Commit

Permalink
fix(@angular-devkit/build-webpack): properly shutdown webpack 5 compi…
Browse files Browse the repository at this point in the history
…lation

This change ensures that the compiler instance is used when closing the compiler.
  • Loading branch information
clydin committed Nov 18, 2020
1 parent c322a29 commit d5348bd
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/angular_devkit/build_webpack/src/webpack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ export function runWebpack(
return createWebpack({ ...config, watch: false }).pipe(
switchMap(webpackCompiler => new Observable<BuildResult>(obs => {
// Webpack 5 has a compiler level close function
// The close function will crash if caching is disabled
const compilerClose = webpackCompiler.options.cache !== false
? (webpackCompiler as { close?(callback: () => void): void }).close
: undefined;
const compilerClose = (webpackCompiler as { close?(callback: () => void): void }).close?.bind(
webpackCompiler,
);

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

0 comments on commit d5348bd

Please sign in to comment.