Skip to content

Incorrect initial total reporting with Rolldown based optimizer (22.1.x) #33773

Description

@imaksp

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

22.0.x

Description

Hi, Initial total considers main bundle raw size for calculation, but Rolldown optimized version has static imports of many chunks at start so it should be counted towards the total.

I also mentioned the same here before: #27715 (comment) but at that time it was experimental.
Our actual initial total for one of the app was ~2MB, now its 915.41 kB, this was found by Claude, and I confirmed it just now. (manually as Claude is down right now).

Minimal Reproduction

Build the any app with some dependencies and lazy routes with 22.0.x and 22.1.x and check difference between Initial total for both.
this is from generated main bundle with Rolldown based optimizer:

import{a as J$1,n as G$2,p as R$1,t as F$1}from"./chunk-Dss6OLyd.js";
// ...
import{a as z$2,i as te,n as Yt$1,r as de$1,t as U$1}from"./chunk-Db26sq0E.js";
// and many more as start of main bundle js

All should be counted towards the total. Rollup based version does not have such static chunk imports at start so it was accurate.

Exception or Error

NA

Your Environment

Angular CLI       : 22.1.3
Angular           : 22.1.0
Node.js           : 24.18.0
Package Manager   : pnpm 11.18.0
Operating System  : darwin arm64

┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package                   │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/aria             │ 22.1.1            │ 22.1.1            │
│ @angular/build            │ 22.1.3            │ ^22.1.3           │
│ @angular/cdk              │ 22.1.1            │ 22.1.1            │
│ @angular/cli              │ 22.1.3            │ 22.1.3            │
│ @angular/common           │ 22.1.0            │ 22.1.0            │
│ @angular/compiler         │ 22.1.0            │ 22.1.0            │
│ @angular/compiler-cli     │ 22.1.0            │ 22.1.0            │
│ @angular/core             │ 22.1.0            │ 22.1.0            │
│ @angular/forms            │ 22.1.0            │ 22.1.0            │
│ @angular/platform-browser │ 22.1.0            │ 22.1.0            │
│ @angular/router           │ 22.1.0            │ 22.1.0            │
│ ng-packagr                │ 22.1.1            │ 22.1.1            │
│ rxjs                      │ 7.8.2             │ 7.8.2             │
│ typescript                │ 6.0.3             │ ~6.0.3            │
│ vitest                    │ 4.1.10            │ 4.1.10            │
└───────────────────────────┴───────────────────┴───────────────────┘

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions