Skip to content

fix(file-size): use config hash for snapshot filename to avoid collisions#6710

Merged
chenjiahan merged 2 commits intomainfrom
file_size_hash_1205
Dec 5, 2025
Merged

fix(file-size): use config hash for snapshot filename to avoid collisions#6710
chenjiahan merged 2 commits intomainfrom
file_size_hash_1205

Conversation

@chenjiahan
Copy link
Member

Summary

When multiple Rsbuild config files are used, the file size snapshots could collide. This change adds a hash of the config file path to the snapshot filename to ensure uniqueness.

Related Links

Checklist

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

Copilot AI review requested due to automatic review settings December 5, 2025 01:51
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@netlify
Copy link

netlify bot commented Dec 5, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit e4013da
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/69323acb61ba970008302e67
😎 Deploy Preview https://deploy-preview-6710--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: 72 (🟢 up 2 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 fixes a collision issue that occurs when multiple Rsbuild config files are used in the same project. By adding a hash of the config file path to the snapshot filename, each configuration now has its own unique snapshot file, preventing conflicts.

  • Added hash-based snapshot filenames to avoid collisions when using multiple Rsbuild config files
  • Updated documentation to reflect the new snapshot filename format (file-sizes-[hash].json)
  • Refactored snapshot path handling to be more flexible and maintainable

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/core/src/plugins/fileSize.ts Implements hash-based snapshot filenames by importing the hash helper, updating getSnapshotPath to accept a hash parameter, refactoring loadPrevSnapshots and saveSnapshots to use the snapshot path directly, and computing the hash from the config file path when diff mode is enabled
website/docs/en/config/performance/print-file-size.mdx Updates documentation to reflect the new snapshot filename format with hash suffix

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

@chenjiahan chenjiahan merged commit a87b206 into main Dec 5, 2025
11 checks passed
@chenjiahan chenjiahan deleted the file_size_hash_1205 branch December 5, 2025 22:59
@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