-
-
Notifications
You must be signed in to change notification settings - Fork 757
fix: use RspackHash for HTML plugin content hash calculation #12465
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
Conversation
✅ Deploy Preview for rspack 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 fixes the HTML plugin's content hash calculation by replacing the generic hash_for_source utility function (which uses DefaultHasher) with RspackHash, ensuring that hash calculations respect the configured output options including hash function (xxhash64/md4/sha256), hash salt, and hash digest format. This alignment with the output configuration ensures generated HTML filenames accurately reflect content changes using the project's configured hashing strategy.
Key changes:
- Replace
hash_for_sourcewithRspackHash::from(&compilation.options.output)for HTML asset content hashing - Add
rspack_hashdependency torspack_plugin_html - Import
std::hash::Hashertrait to enable thewritemethod onRspackHash
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
crates/rspack_plugin_html/src/asset.rs |
Updated create_html_asset function to use RspackHash with output configuration for content hash calculation instead of hash_for_source |
crates/rspack_plugin_html/Cargo.toml |
Added rspack_hash workspace dependency |
Cargo.lock |
Updated lock file to reflect new dependency for rspack_plugin_html |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Rsdoctor Bundle Diff AnalysisFound 5 project(s) in monorepo. 📁 react-10kPath:
📁 react-5kPath:
📁 romePath:
📁 react-1kPath:
📁 ui-componentsPath:
Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
🎉 Size decreased by 512bytes from 48.19MB to 48.19MB (⬇️0.00%) |
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.
👍
CodSpeed Performance ReportMerging #12465 will not alter performanceComparing Summary
Footnotes |
Summary
This PR fixes the content hash calculation in the HTML plugin. Previously, the plugin used
hash_for_sourceutility function to generate content hashes. This change replaces it withRspackHashto ensure the hash calculation is consistent with the output configuration, which guarantees that generated HTML filenames correctly reflect content changes.Checklist