diff --git a/packages/angular/build/src/tools/angular/compilation/aot-compilation.ts b/packages/angular/build/src/tools/angular/compilation/aot-compilation.ts index 6618f00d25f4..adb8988e875b 100644 --- a/packages/angular/build/src/tools/angular/compilation/aot-compilation.ts +++ b/packages/angular/build/src/tools/angular/compilation/aot-compilation.ts @@ -160,7 +160,11 @@ export class AotCompilation extends AngularCompilation { `${host.getCanonicalFileName(relativePath)}@${node.name?.text}`, ); const updateText = angularCompiler.emitHmrUpdateModule(node); - if (updateText === null) { + // If compiler cannot generate an update for the component, prevent template updates. + // Also prevent template updates if $localize is directly present which also currently + // prevents a template update at runtime. + // TODO: Support localized template update modules and remove this check. + if (updateText === null || updateText.includes('$localize')) { // Build is needed if a template cannot be updated templateUpdates = undefined; break;