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
  • Loading branch information
alan-agius4 committed Feb 10, 2025
1 parent aa0ae45 commit b553069
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 b553069

Please sign in to comment.