Skip to content

Commit

Permalink
use std::path::MAIN_SEPARATOR
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Jan 21, 2024
1 parent 331e7ab commit bfdffde
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions crates/swc_ecma_loader/src/resolvers/tsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,13 @@ where
replaced, module_specifier
);
return Ok(Resolution {
slug: Some(replaced.split('/').last().unwrap().into()),
slug: Some(
replaced
.split(std::path::MAIN_SEPARATOR)
.last()
.unwrap()
.into(),
),
filename: FileName::Real(replaced.into()),
});
}
Expand All @@ -280,7 +286,10 @@ where
}

let tp = Path::new(&to[0]);
let slug = to[0].split('/').last().map(|v| v.into());
let slug = to[0]
.split(std::path::MAIN_SEPARATOR)
.last()
.map(|v| v.into());
if tp.is_absolute() {
return Ok(Resolution {
filename: FileName::Real(tp.into()),
Expand Down

0 comments on commit bfdffde

Please sign in to comment.