Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d4ee360

Browse files
clydinalan-agius4
authored andcommitted
fix(@angular/build): keep background referenced HMR update chunks
When HMR is enabled and a component update is sent to the development server, the following background incremental update will no longer remove the previous JavaScript chunk files for lazy routes. This allows the active and running application code within the browser to still access the lazy chunks referenced in the code. This is important for cases such as when a component in a lazy route (that has not yet been accessed) is modified. In this case, the component update is still processed if/when the lazy route is eventually accessed via the module-time evaluation of the component update code.
1 parent cae068b commit d4ee360

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎packages/angular/build/src/builders/application/build-action.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,15 @@ function* emitOutputResults(
358358
};
359359
}
360360

361+
// Do not remove stale files yet if there are template updates.
362+
// Component chunk files may still be referenced in running browser code.
363+
// Module evaluation time component updates will update any of these files.
364+
// This typically occurs when a lazy component is changed that has not yet
365+
// been accessed at runtime.
366+
if (hasTemplateUpdates && incrementalResult.background) {
367+
removedOutputFiles.clear();
368+
}
369+
361370
// Include the removed output and asset files
362371
incrementalResult.removed.push(
363372
...Array.from(removedOutputFiles, ([file, { type }]) => ({

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /