refactor(hmr): diff css updates from the final emitted asset bytes (emit-hash alternative) - #14951
refactor(hmr): diff css updates from the final emitted asset bytes (emit-hash alternative)#14951stormslowly wants to merge 2 commits into
Conversation
Alternative to the create-hash approach: snapshot each chunk's emitted css asset bytes right before assets are written (CompilerEmit) and commit the baseline only after a fully successful emission (CompilerAfterEmit), so any processAssets transform and asset-level operation is covered by the diff.
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 5 projects with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 popular-libsPath:
📁 react-10kPath:
📁 react-1kPath:
📁 react-5kPath:
📁 ui-componentsPath:
Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
⏳ The base commit triggered a linux binding build, but its binary size data has not been generated yet, so the size comparison is skipped. Please re-run this workflow once the ecosystem-benchmark data for that commit is published. Warning Reference only — not the real baseline. The base commit's data isn't ready yet, so this compares against the nearest earlier commit that has data ( ❌ Size increased by 48.13KB from 66.73MB to 66.78MB (⬆️0.07%) |
Merging this PR will not alter performance
Comparing Footnotes
|
Deploying rspack with
|
| Latest commit: |
fe7082d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ac2f815c.rspack-v2.pages.dev |
| Branch Preview URL: | https://feat-hmr-css-emit-asset-hash.rspack-v2.pages.dev |
Why
Side-by-side comparison for #14682: two candidate mechanisms for deciding which chunks enter the hot-update manifest's
css.c/miniCss.c. This draft carries the emit-hash approach so reviewers can weigh it against the create-hash approach on the base branch; it is not meant to land as-is — one of the two gets picked.CompilerEmit), and commit the baseline only after a fully successful emission (CompilerAfterEmit). Every processAssets transform and asset-level operation is covered by the diff —realContentHash-like semantics. Costs: hashing asset bytes on every build (~41µs/MB), the manifest is emitted outside the processAssets pipeline (invisible to processAssets-stage consumers, diverging from webpack), and a staged/commit protocol is needed for failed builds.content_hashhook. Zero extra hashing (the digests are byproducts of hashing the chunk anyway), the manifest stays inside processAssets (webpack parity), and the baseline sharesCompilationRecords' lifecycle. Asset-level rewrites after hashing are out of scope — matching how the js side of HMR already ignores processAssets changes.The two tests unique to this approach encode the semantics only it can provide:
e2e css/hmr-css-processed-after-hash— a banner rewriting the stylesheet during processAssets (content keyed on the compilation hash) is still delivered on a js-only edithotCases/css/css-extract-asset-source-deleted— deleting a css asset's source via the assets proxy is reported asminiCss.rand the stylesheet is removed