Skip to content

Commit

Permalink
fix: context module alternative_requests
Browse files Browse the repository at this point in the history
  • Loading branch information
SyMind committed Sep 11, 2024
1 parent 6541043 commit c1ce16c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions crates/rspack_core/src/context_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1299,14 +1299,12 @@ fn alternative_requests(

for item in std::mem::take(&mut items) {
items.push(item.clone());
// TODO resolveOptions.modules can be array
for module in resolve_options.modules() {
let dir = module.replace('\\', "/");
let full_path: String = format!("{}{}", item.context.replace('\\', "/"), &item.request[1..]);
if full_path.starts_with(&dir) {
if item.request.starts_with(&format!("./{}/", dir)) {
items.push(AlternativeRequest::new(
item.context.clone(),
full_path[(dir.len() + 1)..].to_string(),
item.request[dir.len() + 3..].to_string(),
));
}
}
Expand Down

0 comments on commit c1ce16c

Please sign in to comment.