diff --git a/crates/swc/tests/reflame.rs b/crates/swc/tests/reflame.rs index e70f081ff72b..df5d24444662 100644 --- a/crates/swc/tests/reflame.rs +++ b/crates/swc/tests/reflame.rs @@ -3,8 +3,6 @@ use swc::{ Compiler, }; use swc_common::FileName; -use swc_ecma_ast::EsVersion; -use swc_ecma_parser::{Syntax, TsConfig}; use testing::Tester; fn compile(src: &str, options: Options) -> String { diff --git a/crates/swc_ecma_loader/src/resolvers/tsc.rs b/crates/swc_ecma_loader/src/resolvers/tsc.rs index a4cadabdc1bd..5b49e931b16a 100644 --- a/crates/swc_ecma_loader/src/resolvers/tsc.rs +++ b/crates/swc_ecma_loader/src/resolvers/tsc.rs @@ -1,7 +1,6 @@ -use std::path::{Component, Path, PathBuf}; +use std::path::{Component, PathBuf}; use anyhow::{bail, Context, Error}; -use path_clean::PathClean; use swc_common::FileName; use tracing::{debug, info, trace, Level}; diff --git a/crates/swc_ecma_transforms_module/src/path.rs b/crates/swc_ecma_transforms_module/src/path.rs index 03843870f191..85ad4372d27b 100644 --- a/crates/swc_ecma_transforms_module/src/path.rs +++ b/crates/swc_ecma_transforms_module/src/path.rs @@ -171,7 +171,11 @@ where }; if self.rewrite_relative_imports { - return Ok(target.to_string().into()); + if cfg!(target_os = "windows") { + return Ok(target.to_string().replace('\\', "/").into()); + } else { + return Ok(target.to_string().into()); + } } let mut target = match target {