From 5cf9e9406b61490d02958307b56a546eb1cbd8d1 Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Tue, 4 Mar 2025 12:26:51 +0000 Subject: [PATCH] fix(@angular/build): exclude component styles from 'any' and 'all' budget calculations Previously, component styles were included in the 'any' and 'all' budgets, which could lead to incorrect budget violations. This update ensures that component styles are excluded from these budget calculations. Closes #29609 --- packages/angular/build/src/utils/bundle-calculator.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/angular/build/src/utils/bundle-calculator.ts b/packages/angular/build/src/utils/bundle-calculator.ts index 46558484e39a..3349a8a40830 100644 --- a/packages/angular/build/src/utils/bundle-calculator.ts +++ b/packages/angular/build/src/utils/bundle-calculator.ts @@ -241,7 +241,7 @@ class AllScriptCalculator extends Calculator { class AllCalculator extends Calculator { calculate() { const size = this.assets - .filter((asset) => !asset.name.endsWith('.map')) + .filter((asset) => !asset.name.endsWith('.map') && !asset.componentStyle) .map((asset) => this.getAssetSize(asset)) .reduce((total: number, size: number) => total + size, 0); @@ -269,7 +269,7 @@ class AnyScriptCalculator extends Calculator { class AnyCalculator extends Calculator { calculate() { return this.assets - .filter((asset) => !asset.name.endsWith('.map')) + .filter((asset) => !asset.name.endsWith('.map') && !asset.componentStyle) .map((asset) => ({ size: this.getAssetSize(asset), label: asset.name,