diff --git a/crates/swc/src/config/mod.rs b/crates/swc/src/config/mod.rs index f48ff94f6386..501388474a3a 100644 --- a/crates/swc/src/config/mod.rs +++ b/crates/swc/src/config/mod.rs @@ -1309,10 +1309,10 @@ impl ModuleConfig { available_features: FeatureFlag, ) -> Box { let base = match base { - FileName::Real(v) if !paths.is_empty() => { - FileName::Real(v.canonicalize().unwrap_or_else(|_| v.to_path_buf())) + FileName::Real(path) if !paths.is_empty() && !path.is_absolute() => { + FileName::Real(std::env::current_dir().unwrap().join(path)) } - _ => base.clone(), + _ => base.to_owned(), }; match config {