Skip to content

Commit

Permalink
fix(@ngtools/webpack): don't delete virtual files for resources still…
Browse files Browse the repository at this point in the history
… on disk

Fix #15453
  • Loading branch information
filipesilva authored and vikerman committed Sep 27, 2019
1 parent f548bdd commit dbcacd5
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/ngtools/webpack/src/compiler_host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,16 @@ export class WebpackCompilerHost implements ts.CompilerHost {
return;
}

for (const ext of this._virtualStyleFileExtensions) {
const virtualFile = (fullPath + ext) as Path;
if (this._memoryHost.exists(virtualFile)) {
this._memoryHost.delete(virtualFile);
if (!exists) {
// At this point we're only looking at resource files (html/css/scss/etc).
// If the original was deleted, we should delete the virtual files too.
// If the original it wasn't deleted we should leave them to be overwritten, because webpack
// might begin the loading process before our plugin has re-emitted them.
for (const ext of this._virtualStyleFileExtensions) {
const virtualFile = (fullPath + ext) as Path;
if (this._memoryHost.exists(virtualFile)) {
this._memoryHost.delete(virtualFile);
}
}
}
}
Expand Down

0 comments on commit dbcacd5

Please sign in to comment.