@@ -581,6 +581,8 @@ export function ngcLoader(this: LoaderContext & { _compilation: any }, source: s
581581 result . sourceMap = sourceMap ;
582582 }
583583
584+ const dependencyExtensions = new Set < string > ( ) ;
585+
584586 // Manually add the dependencies for TS files.
585587 // Type only imports will be stripped out by compilation so we need to add them as
586588 // as dependencies.
@@ -589,7 +591,12 @@ export function ngcLoader(this: LoaderContext & { _compilation: any }, source: s
589591 if ( sourceFileName . endsWith ( '.ts' ) ) {
590592 result . errorDependencies . forEach ( dep => this . addDependency ( dep ) ) ;
591593 const dependencies = plugin . getDependencies ( sourceFileName ) ;
592- dependencies . forEach ( dep => this . addDependency ( dep ) ) ;
594+ dependencies . forEach ( dep => {
595+ if ( path . extname ( dep ) ) {
596+ dependencyExtensions . add ( path . extname ( dep ) ) ;
597+ }
598+ this . addDependency ( dep ) ;
599+ } ) ;
593600 }
594601
595602 // NgFactory files depend on the component template, but we can't know what that file
@@ -601,7 +608,12 @@ export function ngcLoader(this: LoaderContext & { _compilation: any }, source: s
601608 const originalFile = sourceFileName . replace ( ngFactoryRe , '.ts' ) ;
602609 this . addDependency ( originalFile ) ;
603610 const origDependencies = plugin . getDependencies ( originalFile ) ;
604- origDependencies . forEach ( dep => this . addDependency ( dep ) ) ;
611+ origDependencies . forEach ( dep => {
612+ if ( path . extname ( dep ) ) {
613+ dependencyExtensions . add ( path . extname ( dep ) ) ;
614+ }
615+ this . addDependency ( dep ) ;
616+ } ) ;
605617 }
606618
607619 // NgStyle files depend on the style file they represent.
@@ -611,9 +623,16 @@ export function ngcLoader(this: LoaderContext & { _compilation: any }, source: s
611623 if ( ngStyleRe . test ( sourceFileName ) ) {
612624 const styleFile = sourceFileName . replace ( ngStyleRe , '' ) ;
613625 const styleDependencies = plugin . getResourceDependencies ( styleFile ) ;
614- styleDependencies . forEach ( dep => this . addDependency ( dep ) ) ;
626+ styleDependencies . forEach ( dep => {
627+ if ( path . extname ( dep ) ) {
628+ dependencyExtensions . add ( path . extname ( dep ) ) ;
629+ }
630+ this . addDependency ( dep ) ;
631+ } ) ;
615632 }
616633
634+ plugin . updateChangedFileExtensions ( dependencyExtensions ) ;
635+
617636 timeEnd ( timeLabel ) ;
618637 cb ( null , result . outputText , result . sourceMap ) ;
619638 } )
0 commit comments