Skip to content

Commit 0826315

Browse files
committed
fix(@angular/build): handle unlocalizable files correctly in localized prerender
Ensure proper handling of unlocalizable files during localized prerendering to prevent errors. Closes #29587 (cherry picked from commit b553069)
1 parent de73b1c commit 0826315

File tree

1 file changed

+7
-4
lines changed
  • packages/angular/build/src/builders/application

1 file changed

+7
-4
lines changed

packages/angular/build/src/builders/application/i18n.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ export async function inlineI18n(
6464
// For each active locale, use the inliner to process the output files of the build.
6565
const updatedOutputFiles = [];
6666
const updatedAssetFiles = [];
67+
// Root and SSR entry files are not modified.
68+
const unModifiedOutputFiles = executionResult.outputFiles.filter(
69+
({ type }) => type === BuildOutputFileType.Root || type === BuildOutputFileType.ServerRoot,
70+
);
71+
6772
try {
6873
for (const locale of i18nOptions.inlineLocales) {
6974
// A locale specific set of files is returned from the inliner.
@@ -87,7 +92,7 @@ export async function inlineI18n(
8792
...options,
8893
baseHref: getLocaleBaseHref(baseHref, i18nOptions, locale) ?? baseHref,
8994
},
90-
localeOutputFiles,
95+
[...unModifiedOutputFiles, ...localeOutputFiles],
9196
executionResult.assetFiles,
9297
initialFiles,
9398
locale,
@@ -124,9 +129,7 @@ export async function inlineI18n(
124129
// Update the result with all localized files.
125130
executionResult.outputFiles = [
126131
// Root and SSR entry files are not modified.
127-
...executionResult.outputFiles.filter(
128-
({ type }) => type === BuildOutputFileType.Root || type === BuildOutputFileType.ServerRoot,
129-
),
132+
...unModifiedOutputFiles,
130133
// Updated files for each locale.
131134
...updatedOutputFiles,
132135
];

0 commit comments

Comments
 (0)