Skip to content

Commit 7a7ad45

Browse files
committed
.
1 parent 91ec9f2 commit 7a7ad45

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

packages/ngtools/webpack/src/angular_compiler_plugin.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -582,19 +582,18 @@ export class AngularCompilerPlugin {
582582
// Registration hook for webpack plugin.
583583
// tslint:disable-next-line:no-big-function
584584
apply(compiler: Compiler & { watchMode?: boolean }) {
585-
// only present for webpack 4.23.0+, assume true otherwise
586-
const watchMode = compiler.watchMode === undefined ? true : compiler.watchMode;
587-
588585
// cleanup if not watching
589-
if (!watchMode) {
590-
compiler.hooks.thisCompilation.tap('angular-compiler', compilation => {
591-
compilation.hooks.finishModules.tap('angular-compiler', () => {
586+
compiler.hooks.thisCompilation.tap('angular-compiler', compilation => {
587+
compilation.hooks.finishModules.tap('angular-compiler', () => {
588+
// only present for webpack 4.23.0+, assume true otherwise
589+
const watchMode = compiler.watchMode === undefined ? true : compiler.watchMode;
590+
if (!watchMode) {
592591
this._program = null;
593592
this._transformers = [];
594593
this._resourceLoader = undefined;
595-
});
594+
}
596595
});
597-
}
596+
});
598597

599598
// Decorate inputFileSystem to serve contents of CompilerHost.
600599
// Use decorated inputFileSystem in watchFileSystem.
@@ -634,6 +633,9 @@ export class AngularCompilerPlugin {
634633
}
635634
}
636635

636+
// only present for webpack 4.23.0+, assume true otherwise
637+
const watchMode = compiler.watchMode === undefined ? true : compiler.watchMode;
638+
637639
// Create the webpack compiler host.
638640
const webpackCompilerHost = new WebpackCompilerHost(
639641
this._compilerOptions,

0 commit comments

Comments
 (0)