Skip to content

Conversation

@LingyuCoder
Copy link
Contributor

@LingyuCoder LingyuCoder commented Dec 16, 2025

Summary

This PR fixes the content hash calculation in the HTML plugin. Previously, the plugin used hash_for_source utility function to generate content hashes. This change replaces it with RspackHash to ensure the hash calculation is consistent with the output configuration, which guarantees that generated HTML filenames correctly reflect content changes.

Checklist

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

Copilot AI review requested due to automatic review settings December 16, 2025 06:39
@github-actions github-actions bot added team The issue/pr is created by the member of Rspack. release: bug fix release: bug related release(mr only) labels Dec 16, 2025
@netlify
Copy link

netlify bot commented Dec 16, 2025

Deploy Preview for rspack ready!

Name Link
🔨 Latest commit 9fae1a1
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/6941032b9bb41700081c1f9d
😎 Deploy Preview https://deploy-preview-12465--rspack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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 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_source with RspackHash::from(&compilation.options.output) for HTML asset content hashing
  • Add rspack_hash dependency to rspack_plugin_html
  • Import std::hash::Hasher trait to enable the write method on RspackHash

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.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 16, 2025

Rsdoctor Bundle Diff Analysis

Found 5 project(s) in monorepo.

📁 react-10k

Path: ../build-tools-performance/cases/react-10k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 5.7 MB - -
📄 JavaScript 5.7 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 react-5k

Path: ../build-tools-performance/cases/react-5k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 2.7 MB - -
📄 JavaScript 2.7 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 rome

Path: ../build-tools-performance/cases/rome/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 984.3 KB - -
📄 JavaScript 984.3 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 react-1k

Path: ../build-tools-performance/cases/react-1k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 823.6 KB - -
📄 JavaScript 823.6 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 ui-components

Path: ../build-tools-performance/cases/ui-components/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 2.1 MB - -
📄 JavaScript 2.0 MB - -
🎨 CSS 83.0 KB - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

Generated by Rsdoctor GitHub Action

@github-actions
Copy link
Contributor

📦 Binary Size-limit

Comparing 9fae1a1 to fix: add case-sensitive check for emit assets (#12462) by harpsealjs

🎉 Size decreased by 512bytes from 48.19MB to 48.19MB (⬇️0.00%)

Copy link
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@chenjiahan chenjiahan enabled auto-merge (squash) December 16, 2025 07:12
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 16, 2025

CodSpeed Performance Report

Merging #12465 will not alter performance

Comparing fix/html-plugin-hash-calculation (9fae1a1) with main (fefd3dc)1

Summary

✅ 17 untouched

Footnotes

  1. No successful run was found on main (726679b) during the generation of this report, so fefd3dc was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@chenjiahan chenjiahan merged commit fbc927a into main Dec 16, 2025
52 checks passed
@chenjiahan chenjiahan deleted the fix/html-plugin-hash-calculation branch December 16, 2025 07:38
@CPunisher CPunisher mentioned this pull request Dec 17, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants