Skip to content

feat: refine size diff output for new files#6691

Merged
chenjiahan merged 2 commits intomainfrom
size_diff_1203
Dec 3, 2025
Merged

feat: refine size diff output for new files#6691
chenjiahan merged 2 commits intomainfrom
size_diff_1203

Conversation

@chenjiahan
Copy link
Member

Summary

This change improves the readability and consistency of the build size report. Previously, new files were displayed with the literal marker NEW. The diff is now calculated against a baseline of 0 kB, which makes new-file additions follow the same format as other size diffs.

Using a numeric diff provides clearer feedback on bundle growth and avoids introducing a unique state in the size table.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings December 3, 2025 11:18
@netlify
Copy link

netlify bot commented Dec 3, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 819701f
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/69303473c0c0700008275d88
😎 Deploy Preview https://deploy-preview-6691--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 69 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a 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 refines the file size diff output for new files in build reports. Previously, new files were displayed with a literal NEW marker, which was inconsistent with how size changes were displayed for existing files. Now, all files show numeric diffs, with new files calculated against a baseline of 0 kB.

  • Simplified diff calculation logic to use 0 kB baseline for files without previous size data
  • Updated documentation to reflect the new diff format and removed references to the "NEW" marker
  • Changed previousSizes parameter type to allow null when diff is disabled

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
packages/core/src/plugins/fileSize.ts Refactored diff calculation to use 0 baseline for new files; removed isNew flag and related logic; changed previousSizes type to FileSizeCache | null
website/docs/en/config/performance/print-file-size.mdx Updated documentation to show numeric diffs for new files; removed sections explaining the "NEW" marker; reformatted code examples
website/docs/zh/config/performance/print-file-size.mdx Applied formatting fixes to code examples for consistency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chenjiahan chenjiahan merged commit 72c3bef into main Dec 3, 2025
11 checks passed
@chenjiahan chenjiahan deleted the size_diff_1203 branch December 3, 2025 13:11
@chenjiahan chenjiahan mentioned this pull request Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant