From 25669cf34679985ac3e5135922a29ac575c64d5e Mon Sep 17 00:00:00 2001 From: Cong-Cong Date: Fri, 27 Dec 2024 14:13:35 +0800 Subject: [PATCH] fix: alias priority --- crates/rspack_core/src/normal_module_factory.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/rspack_core/src/normal_module_factory.rs b/crates/rspack_core/src/normal_module_factory.rs index 81b0000e0dd..f76586db338 100644 --- a/crates/rspack_core/src/normal_module_factory.rs +++ b/crates/rspack_core/src/normal_module_factory.rs @@ -644,7 +644,8 @@ impl NormalModuleFactory { fn calculate_resolve_options(&self, module_rules: &[&ModuleRuleEffect]) -> Option> { let mut resolved: Option = None; - for rule in module_rules { + // TODO: 为了 alias 的优先级临时修改,之后修改 + for rule in module_rules.iter().rev() { if let Some(rule_resolve) = &rule.resolve { if let Some(r) = resolved { resolved = Some(r.merge(rule_resolve.to_owned()));