Skip to content

Commit

Permalink
fix(@angular/build): handle unlocalizable files correctly in localize…
Browse files Browse the repository at this point in the history
…d prerender

Ensure proper handling of unlocalizable files during localized prerendering to prevent errors.

Closes #29587

(cherry picked from commit b553069)
  • Loading branch information
alan-agius4 committed Feb 10, 2025
1 parent de73b1c commit 0826315
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/angular/build/src/builders/application/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ export async function inlineI18n(
// For each active locale, use the inliner to process the output files of the build.
const updatedOutputFiles = [];
const updatedAssetFiles = [];
// Root and SSR entry files are not modified.
const unModifiedOutputFiles = executionResult.outputFiles.filter(
({ type }) => type === BuildOutputFileType.Root || type === BuildOutputFileType.ServerRoot,
);

try {
for (const locale of i18nOptions.inlineLocales) {
// A locale specific set of files is returned from the inliner.
Expand All @@ -87,7 +92,7 @@ export async function inlineI18n(
...options,
baseHref: getLocaleBaseHref(baseHref, i18nOptions, locale) ?? baseHref,
},
localeOutputFiles,
[...unModifiedOutputFiles, ...localeOutputFiles],
executionResult.assetFiles,
initialFiles,
locale,
Expand Down Expand Up @@ -124,9 +129,7 @@ export async function inlineI18n(
// Update the result with all localized files.
executionResult.outputFiles = [
// Root and SSR entry files are not modified.
...executionResult.outputFiles.filter(
({ type }) => type === BuildOutputFileType.Root || type === BuildOutputFileType.ServerRoot,
),
...unModifiedOutputFiles,
// Updated files for each locale.
...updatedOutputFiles,
];
Expand Down

0 comments on commit 0826315

Please sign in to comment.