Skip to content

Commit 5cf12ec

Browse files
authored
fix: generate stable extract css runtime by sorting css chunks (#12246)
* fix: generate stable extract css runtime by sorting css chunks * fix: generate stable extract css runtime by sorting css chunks * fix: generate stable extract css runtime by sorting css chunks
1 parent 1f482b5 commit 5cf12ec

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/rspack_core/src/utils/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ pub fn compare_chunks_with_graph(
252252
chunk_a_ukey: &ChunkUkey,
253253
chunk_b_ukey: &ChunkUkey,
254254
) -> Ordering {
255-
let modules_a = chunk_graph.get_chunk_modules_identifier(chunk_a_ukey);
256-
let modules_b = chunk_graph.get_chunk_modules_identifier(chunk_b_ukey);
255+
let modules_a = chunk_graph.get_ordered_chunk_modules_identifier(chunk_a_ukey);
256+
let modules_b = chunk_graph.get_ordered_chunk_modules_identifier(chunk_b_ukey);
257257
if modules_a.len() > modules_b.len() {
258258
return Ordering::Less;
259259
}

crates/rspack_plugin_extract_css/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ version.workspace = true
88
[dependencies]
99
async-trait = { workspace = true }
1010
cow-utils = { workspace = true }
11+
itertools = { workspace = true }
1112
regex = { workspace = true }
1213
rspack_cacheable = { workspace = true }
1314
rspack_collections = { workspace = true }

crates/rspack_plugin_extract_css/src/runtime.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::ptr::NonNull;
22

3+
use itertools::Itertools;
34
use rspack_collections::UkeySet;
45
use rspack_core::{
56
BooleanMatcher, ChunkUkey, Compilation, RuntimeGlobals, RuntimeModule, RuntimeModuleStage,
@@ -222,6 +223,7 @@ impl RuntimeModule for CssLoadingRuntimeModule {
222223
)
223224
})
224225
})
226+
.sorted_unstable()
225227
.collect::<String>()
226228
)
227229
})),

0 commit comments

Comments
 (0)