File tree 1 file changed +10
-4
lines changed
packages/ngtools/webpack/src
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 {
141
141
return ;
142
142
}
143
143
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
+ }
148
154
}
149
155
}
150
156
}
You can’t perform that action at this time.
0 commit comments