Skip to content

Commit

Permalink
windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Aug 24, 2023
1 parent d6e58bb commit 1c9271c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions crates/swc_ecma_transforms_module/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,8 @@ where
} else {
Cow::Owned(format!("./{}", s))
};
if cfg!(target_os = "windows") {
Ok(to_specifier(s.replace('\\', "/").into(), orig_filename))
} else {
Ok(to_specifier(s.into_owned().into(), orig_filename))
}

Ok(to_specifier(s.into_owned().into(), orig_filename))
}
}

Expand Down Expand Up @@ -319,5 +316,9 @@ fn to_specifier(mut target_path: PathBuf, orig_filename: Option<&str>) -> JsWord
target_path.set_extension("");
}

target_path.display().to_string().into()
if cfg!(target_os = "windows") {
target_path.display().to_string().replace('\\', "/").into()
} else {
target_path.display().to_string().into()
}
}

0 comments on commit 1c9271c

Please sign in to comment.