Skip to content

Commit c4de347

Browse files
clydinalan-agius4
authored andcommittedJan 20, 2025·
fix(@angular/build): perform full reload for templates with $localize usage
Component template updates that contain `$localize` usage currently may result in incorrect updates at runtime. To avoid this problem, any template update module that contains `$localize` will now perform a full rebuild. Support for component updates of these templates will be added in a future release. (cherry picked from commit bfaa4d2)
1 parent 7d8c341 commit c4de347

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎packages/angular/build/src/tools/angular/compilation/aot-compilation.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,11 @@ export class AotCompilation extends AngularCompilation {
160160
`${host.getCanonicalFileName(relativePath)}@${node.name?.text}`,
161161
);
162162
const updateText = angularCompiler.emitHmrUpdateModule(node);
163-
if (updateText === null) {
163+
// If compiler cannot generate an update for the component, prevent template updates.
164+
// Also prevent template updates if $localize is directly present which also currently
165+
// prevents a template update at runtime.
166+
// TODO: Support localized template update modules and remove this check.
167+
if (updateText === null || updateText.includes('$localize')) {
164168
// Build is needed if a template cannot be updated
165169
templateUpdates = undefined;
166170
break;

0 commit comments

Comments
 (0)
Please sign in to comment.