Skip to content

Commit 03f7f9f

Browse files
committed
chore: fix sort
1 parent d571476 commit 03f7f9f

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

crates/rspack_plugin_next_flight_client_entry/src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ mod is_metadata_route;
55
mod loader_util;
66

77
use std::{
8+
cmp::Ordering,
89
mem,
910
ops::DerefMut,
1011
path::Path,
@@ -642,10 +643,12 @@ impl FlightClientEntryPlugin {
642643
.collect();
643644

644645
modules.sort_unstable_by(|a, b| {
645-
if REGEX_CSS.is_match(&b.0) {
646-
std::cmp::Ordering::Greater
647-
} else {
648-
a.0.cmp(&b.0)
646+
let a_is_css = REGEX_CSS.is_match(&a.0);
647+
let b_is_css = REGEX_CSS.is_match(&b.0);
648+
match ((a_is_css, b_is_css)) {
649+
(false, true) => Ordering::Less,
650+
(true, false) => Ordering::Greater,
651+
(_, _) => a.0.cmp(&b.0),
649652
}
650653
});
651654

examples/rspack.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
context: __dirname,
3+
entry: {
4+
main: './src/index.js'
5+
},
6+
plugins: [{
7+
apply(compiler) {
8+
compiler.hooks.emit.tap({ name: 'MyPlugin', stage: 0 }, compilation => {
9+
console.log('This is an example plugin!');
10+
})
11+
12+
}
13+
}]
14+
}

examples/src/index.js

Whitespace-only changes.

0 commit comments

Comments
 (0)