Skip to content

Commit

Permalink
fix: contenthash should care about ChunkGraphModule#id (#2292)
Browse files Browse the repository at this point in the history
* fix: contenthash should care about ChunkGraphModule#id

* Changeset

* Fix error
  • Loading branch information
hyf0 authored Mar 16, 2023
1 parent 00f66b4 commit 6d9eb8b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/seven-dancers-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rspack/binding": patch
---

fix: contenthash should care about ChunkGraphModule#id
10 changes: 8 additions & 2 deletions crates/rspack_plugin_css/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,10 +593,16 @@ impl Plugin for CssPlugin {

ordered_modules
.iter()
.map(|module_identifier| compilation.module_graph.get_module_hash(module_identifier))
.for_each(|current| {
.map(|mgm| {
(
compilation.module_graph.get_module_hash(mgm),
compilation.chunk_graph.get_module_id(*mgm),
)
})
.for_each(|(current, id)| {
if let Some(current) = current {
current.hash(&mut hasher);
id.hash(&mut hasher);
}
});

Expand Down
12 changes: 8 additions & 4 deletions crates/rspack_plugin_javascript/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,13 +434,17 @@ impl Plugin for JsPlugin {
ordered_modules
.iter()
.map(|mgm| {
compilation
.module_graph
.get_module_hash(&mgm.module_identifier)
(
compilation
.module_graph
.get_module_hash(&mgm.module_identifier),
compilation.chunk_graph.get_module_id(mgm.module_identifier),
)
})
.for_each(|current| {
.for_each(|(current, id)| {
if let Some(current) = current {
current.hash(&mut hasher);
id.hash(&mut hasher);
}
});

Expand Down

0 comments on commit 6d9eb8b

Please sign in to comment.