Skip to content

feat(rolldown): compare rendered module sizes across builds - #631

Closed
SaKaNa-Y wants to merge 3 commits into
vitejs:mainfrom
SaKaNa-Y:fix/compare-module-metrics
Closed

SaKaNa-Y wants to merge 3 commits into
vitejs:mainfrom
SaKaNa-Y:fix/compare-module-metrics

Conversation

@SaKaNa-Y

@SaKaNa-Y SaKaNa-Y commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

When a chunk grows between builds, the Modules tab helps developers find which modules changed. It previously compared the size reported by the last transform hook. A module can appear in the output without a transform measurement, and treating a missing value as zero can report growth even when the source stays the same.

Compare the bytes Rolldown records for each module in ModuleRenderedReady. Rolldown measures these bytes after tree-shaking and before chunk minification, summed across all output chunks that contain the module. The session cache now stores these measurements. The Modules tab labels the total Rendered Size.

Present in both builds, rendered size missing → Unavailable, no numeric delta
Present in both builds, measured zero         → 0 B
Present in only one build                     → Added or Removed

Logs without the event show Unavailable for rendered size, even when they contain transform measurements. Module detail and Detailed List still show transform sizes, including a final zero after reopening the session.

Follow-up to #615 and #601.

Evidence

  • Chrome, two Rolldown 1.3.2 builds with no transform plugins: lib.js showed 51 B to 45 B (−6 B). The session totals were 85 B and 79 B.
  • With the event removed from one copy, the comparison kept the measured side and showed Unavailable on the other. Two archived 1.2.14 logs showed Unavailable on both sides. Module detail on a saved session still showed 31 B to 0 B.
  • RPC tests cover added and removed modules, missing sizes and measured zero. Reader tests cover a cache reopen with rendered bytes and separate transform sizes.
  • Lint and type checks passed. The suite passed 412 tests and skipped two. All seven build tasks succeeded.

Merge Danger

Door: two-way

Blast Radius: Rolldown session comparisons and derived caches.

The cache version change rebuilds derived entries from the original logs. A rendered size delta can differ from the final chunk size delta because whole-chunk minification happens later.

@pkg-pr-new

pkg-pr-new Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/@vitejs/devtools@631

@vitejs/devtools-kit

npm i https://pkg.pr.new/@vitejs/devtools-kit@631

@vitejs/devtools-oxc

npm i https://pkg.pr.new/@vitejs/devtools-oxc@631

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/@vitejs/devtools-rolldown@631

@vitejs/devtools-vite

npm i https://pkg.pr.new/@vitejs/devtools-vite@631

@vitejs/devtools-vitest

npm i https://pkg.pr.new/@vitejs/devtools-vitest@631

commit: 494c74a

Let module metrics opt in to displaying zero-byte sizes. Preserve the source size in the duration-only cache entry so reopening an unchanged module shows the same size on both sides.
Read ModuleRenderedReady into the session cache and use its per-module bytes for comparison rows and totals. Older logs keep an unavailable size while module details continue to show transform measurements.
@SaKaNa-Y SaKaNa-Y changed the title fix(rolldown): preserve missing and zero comparison metrics feat(rolldown): compare rendered module sizes across builds Nov 14, 2026
@SaKaNa-Y
SaKaNa-Y marked this pull request as ready for review November 14, 2026 06:04
@SaKaNa-Y SaKaNa-Y closed this Nov 14, 2026
@SaKaNa-Y
SaKaNa-Y deleted the fix/compare-module-metrics branch November 14, 2026 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant