Skip to content

fix(@angular/build): always use AOT when extracting i18n messages - #34303

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
thekhegay:fix/extract-i18n-force-aot
Oct 12, 2026
Merged

alan-agius4 merged 1 commit into
angular:mainfrom
thekhegay:fix/extract-i18n-force-aot

Conversation

@thekhegay

@thekhegay thekhegay commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

PR Checklist

PR Type

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #31227

When build target has aot: false, extract-i18n builds app in JIT, so template i18n messages never turn into $localize calls and are missing from extracted file withot any warning
Webpack extraction always forced aot: true, so this only shows up with application builder

What is the new behavior?

Application extraction in @angular/build and @angular-devkit/build-angular forces aot: true, same as webpack one
New case in extract-ivy.ts sets aot: false on build target and still expects template message, it fails on main

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

If overiding user's aot silently is not wanted, I can log warning or error for aot: false instead

Closes: #31227

with `aot: false` on build target, extraction built app in JIT and template messages never got into extracted file
webpack extraction alredy forced AOT, application extraction now does same

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request ensures that Ahead-of-Time (AOT) compilation is explicitly enabled (buildOptions.aot = true) during i18n message extraction in both the Angular build and Angular DevKit builders. This guarantees that template messages are correctly extracted even if the build target disables AOT in the configuration. An end-to-end test has been added to verify this behavior. There are no review comments, so I have no feedback to provide.

@alan-agius4 alan-agius4 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alan-agius4 alan-agius4 added target: patch This PR is targeted for the next patch release action: merge The PR is ready for merge by the caretaker labels Oct 12, 2026
@alan-agius4
alan-agius4 merged commit 1392304 into angular:main Oct 12, 2026
42 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New build system application missing i18n strings from templates

2 participants