Skip to content

Commit c989c91

Browse files
committed
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 (cherry picked from commit 434198c)
1 parent f92bfa4 commit c989c91

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/angular/build/src/utils/bundle-calculator.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ class AllScriptCalculator extends Calculator {
241241
class AllCalculator extends Calculator {
242242
calculate() {
243243
const size = this.assets
244-
.filter((asset) => !asset.name.endsWith('.map'))
244+
.filter((asset) => !asset.name.endsWith('.map') && !asset.componentStyle)
245245
.map((asset) => this.getAssetSize(asset))
246246
.reduce((total: number, size: number) => total + size, 0);
247247

@@ -269,7 +269,7 @@ class AnyScriptCalculator extends Calculator {
269269
class AnyCalculator extends Calculator {
270270
calculate() {
271271
return this.assets
272-
.filter((asset) => !asset.name.endsWith('.map'))
272+
.filter((asset) => !asset.name.endsWith('.map') && !asset.componentStyle)
273273
.map((asset) => ({
274274
size: this.getAssetSize(asset),
275275
label: asset.name,

0 commit comments

Comments
 (0)