File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
packages/ngtools/webpack/src Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -141,10 +141,16 @@ export class WebpackCompilerHost implements ts.CompilerHost {
141141 return ;
142142 }
143143
144- for ( const ext of this . _virtualStyleFileExtensions ) {
145- const virtualFile = ( fullPath + ext ) as Path ;
146- if ( this . _memoryHost . exists ( virtualFile ) ) {
147- this . _memoryHost . delete ( virtualFile ) ;
144+ if ( ! exists ) {
145+ // At this point we're only looking at resource files (html/css/scss/etc).
146+ // If the original was deleted, we should delete the virtual files too.
147+ // If the original it wasn't deleted we should leave them to be overwritten, because webpack
148+ // might begin the loading process before our plugin has re-emitted them.
149+ for ( const ext of this . _virtualStyleFileExtensions ) {
150+ const virtualFile = ( fullPath + ext ) as Path ;
151+ if ( this . _memoryHost . exists ( virtualFile ) ) {
152+ this . _memoryHost . delete ( virtualFile ) ;
153+ }
148154 }
149155 }
150156 }
You can’t perform that action at this time.
0 commit comments