@@ -240,20 +240,16 @@ export class AngularCompilerPlugin implements Tapable {
240
240
tsHost : webpackCompilerHost
241
241
} ) as CompilerHost & WebpackCompilerHost ;
242
242
243
- // Override some files in the FileSystem.
244
- if ( this . _options . hostOverrideFileSystem ) {
245
- for ( const filePath of Object . keys ( this . _options . hostOverrideFileSystem ) ) {
246
- this . _compilerHost . writeFile ( filePath ,
247
- this . _options . hostOverrideFileSystem [ filePath ] , false ) ;
248
- }
249
- }
250
243
// Override some files in the FileSystem with paths from the actual file system.
251
244
if ( this . _options . hostReplacementPaths ) {
252
245
for ( const filePath of Object . keys ( this . _options . hostReplacementPaths ) ) {
253
246
const replacementFilePath = this . _options . hostReplacementPaths [ filePath ] ;
254
247
const content = this . _compilerHost . readFile ( replacementFilePath ) ;
255
248
this . _compilerHost . writeFile ( filePath , content , false ) ;
256
249
}
250
+
251
+ // Reset the file tracker so overriden files are not picked up as changes.
252
+ this . _compilerHost . resetChangedFileTracker ( ) ;
257
253
}
258
254
259
255
// Use an identity function as all our paths are absolute already.
@@ -645,9 +641,8 @@ export class AngularCompilerPlugin implements Tapable {
645
641
646
642
private _makeTransformers ( ) {
647
643
648
- // TODO use compilerhost.denormalize when #8210 is merged.
649
644
const isAppPath = ( fileName : string ) =>
650
- this . _rootNames . includes ( fileName . replace ( / \/ / g , path . sep ) ) ;
645
+ ! fileName . endsWith ( '.ngfactory.ts' ) && ! fileName . endsWith ( '.ngstyle.ts' ) ;
651
646
const isMainPath = ( fileName : string ) => fileName === this . _mainPath ;
652
647
const getEntryModule = ( ) => this . entryModule ;
653
648
const getLazyRoutes = ( ) => this . _lazyRoutes ;
@@ -691,17 +686,19 @@ export class AngularCompilerPlugin implements Tapable {
691
686
// Make a new program and load the Angular structure.
692
687
. then ( ( ) => this . _createOrUpdateProgram ( ) )
693
688
. then ( ( ) => {
694
- // Try to find lazy routes.
695
- // We need to run the `listLazyRoutes` the first time because it also navigates libraries
696
- // and other things that we might miss using the (faster) findLazyRoutesInAst.
697
- // Lazy routes modules will be read with compilerHost and added to the changed files.
698
- const changedTsFiles = this . _getChangedTsFiles ( ) ;
699
- if ( this . _ngCompilerSupportsNewApi ) {
700
- this . _processLazyRoutes ( this . _listLazyRoutesFromProgram ( ) ) ;
701
- } else if ( this . _firstRun ) {
702
- this . _processLazyRoutes ( this . _getLazyRoutesFromNgtools ( ) ) ;
703
- } else if ( changedTsFiles . length > 0 ) {
704
- this . _processLazyRoutes ( this . _findLazyRoutesInAst ( changedTsFiles ) ) ;
689
+ if ( this . entryModule ) {
690
+ // Try to find lazy routes if we have an entry module.
691
+ // We need to run the `listLazyRoutes` the first time because it also navigates libraries
692
+ // and other things that we might miss using the (faster) findLazyRoutesInAst.
693
+ // Lazy routes modules will be read with compilerHost and added to the changed files.
694
+ const changedTsFiles = this . _getChangedTsFiles ( ) ;
695
+ if ( this . _ngCompilerSupportsNewApi ) {
696
+ this . _processLazyRoutes ( this . _listLazyRoutesFromProgram ( ) ) ;
697
+ } else if ( this . _firstRun ) {
698
+ this . _processLazyRoutes ( this . _getLazyRoutesFromNgtools ( ) ) ;
699
+ } else if ( changedTsFiles . length > 0 ) {
700
+ this . _processLazyRoutes ( this . _findLazyRoutesInAst ( changedTsFiles ) ) ;
701
+ }
705
702
}
706
703
} )
707
704
. then ( ( ) => {
0 commit comments