Skip to content

Commit 880a50c

Browse files
committed
fix(@angular/build): exclude unmodified files from logs with --localize
Ensures that only modified files are displayed in logs when using the `--localize` flag, preventing unnecessary noise. Closes #29586
1 parent dca408b commit 880a50c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/angular/build/src/builders/application/execute-build.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,6 @@ export async function executeBuild(
184184

185185
executionResult.outputFiles.push(...outputFiles);
186186

187-
const changedFiles =
188-
rebuildState && executionResult.findChangedFiles(rebuildState.previousOutputInfo);
189-
190187
// Analyze files for bundle budget failures if present
191188
let budgetFailures: BudgetCalculatorResult[] | undefined;
192189
if (options.budgets) {
@@ -288,6 +285,8 @@ export async function executeBuild(
288285
}
289286

290287
if (!jsonLogs) {
288+
const changedFiles =
289+
rebuildState && executionResult.findChangedFiles(rebuildState.previousOutputInfo);
291290
executionResult.addLog(
292291
logBuildStats(
293292
metafile,

packages/angular/build/src/tools/esbuild/utils.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ export function logBuildStats(
4040
ssrOutputEnabled?: boolean,
4141
verbose?: boolean,
4242
): string {
43+
// Remove the i18n subpath in case the build is using i18n.
44+
// en-US/main.js -> main.js
45+
const normalizedChangedFiles: Set<string> = new Set(
46+
[...(changedFiles ?? [])].map((f) => basename(f)),
47+
);
4348
const browserStats: BundleStats[] = [];
4449
const serverStats: BundleStats[] = [];
4550
let unchangedCount = 0;
@@ -52,7 +57,7 @@ export function logBuildStats(
5257
}
5358

5459
// Show only changed files if a changed list is provided
55-
if (changedFiles && !changedFiles.has(file)) {
60+
if (normalizedChangedFiles.size && !normalizedChangedFiles.has(file)) {
5661
++unchangedCount;
5762
continue;
5863
}

0 commit comments

Comments
 (0)