-
-
Notifications
You must be signed in to change notification settings - Fork 238
feat(core): add showDiff option to printFileSize #6635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ize comparison Add a new `showDiff` option to performance.printFileSize that displays file size changes compared to the previous build. This helps developers track how their changes affect bundle sizes over time.
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new showDiff option to performance.printFileSize that displays file size changes between builds. The feature helps developers track how their changes affect bundle sizes by showing color-coded differences (red for increases, green for decreases, "NEW" for new files) in a dedicated "Diff" column. The implementation caches build sizes in node_modules/.cache/rsbuild/ and uses hash normalization to match files across builds. The feature is opt-in and disabled by default.
Key changes:
- Adds
showDiffboolean option toPrintFileSizeOptionstype - Implements file size caching mechanism with hash normalization for cross-build file matching
- Updates output formatting to include a conditional "Diff" column with color-coded size changes
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
website/docs/en/config/performance/print-file-size.mdx |
Documents the new showDiff option with examples showing the diff column output |
packages/core/tests/fileSize.test.ts |
Adds comprehensive test coverage for the normalizeFileName function and updates asset exclusion tests |
packages/core/src/types/config.ts |
Adds showDiff boolean property to PrintFileSizeOptions interface |
packages/core/src/plugins/fileSize.ts |
Implements core diff functionality including cache management, file name normalization, and diff column rendering |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
chenjiahan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
… diff display fir different sizes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| expect(normalizeFileName('bundle.A1B2C3D4.js')).toBe( | ||
| 'bundle.A1B2C3D4.js', | ||
| ); | ||
| // Only lowercase a-f are matched by the regex |
Copilot
AI
Nov 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test verifies that uppercase hex digits are NOT removed, but there's no test verifying that lowercase hex digits ARE removed in the same scenario. Add a test case with normalizeFileName('bundle.a1b2c3d4.js') to ensure the lowercase version is correctly normalized to 'bundle.js'.
|
Thank you for reviewing! I have pushed some changes |


Add showDiff option to printFileSize for build-to-build size comparison
Add a new
showDiffoption to performance.printFileSize that displays file size changes compared to the previous build. This helps developers track how their changes affect bundle sizes over time.Summary
Adds a showDiff option to performance.printFileSize that displays file size changes between builds. Shows color-coded differences (red for increases, green for decreases, "NEW" for new files) in a dedicated "Diff" column. Caches previous build sizes in node_modules/.cache/rsbuild/ for comparison, with automatic hash normalization to match files across builds. Opt-in feature (disabled by default).
E.G.

Related Links
#6100
Checklist