@@ -582,19 +582,18 @@ export class AngularCompilerPlugin {
582
582
// Registration hook for webpack plugin.
583
583
// tslint:disable-next-line:no-big-function
584
584
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
-
588
585
// 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 ) {
592
591
this . _program = null ;
593
592
this . _transformers = [ ] ;
594
593
this . _resourceLoader = undefined ;
595
- } ) ;
594
+ }
596
595
} ) ;
597
- }
596
+ } ) ;
598
597
599
598
// Decorate inputFileSystem to serve contents of CompilerHost.
600
599
// Use decorated inputFileSystem in watchFileSystem.
@@ -634,6 +633,9 @@ export class AngularCompilerPlugin {
634
633
}
635
634
}
636
635
636
+ // only present for webpack 4.23.0+, assume true otherwise
637
+ const watchMode = compiler . watchMode === undefined ? true : compiler . watchMode ;
638
+
637
639
// Create the webpack compiler host.
638
640
const webpackCompilerHost = new WebpackCompilerHost (
639
641
this . _compilerOptions ,
0 commit comments