Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
},
{
test: /\.js$/,
// Factory files are processed by BO in the rules added in typescript.ts.
exclude: /(ngfactory|ngstyle)\.js$/,
...buildOptimizerUseRule,
},
{
Expand Down
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 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