diff --git a/crates/swc/src/config/mod.rs b/crates/swc/src/config/mod.rs index 28610e524b26..5f2facaf3f45 100644 --- a/crates/swc/src/config/mod.rs +++ b/crates/swc/src/config/mod.rs @@ -1333,6 +1333,10 @@ impl ModuleConfig { .unwrap_or_else(|_| path.to_path_buf()), ), _ => base.to_owned(), + FileName::Real(v) if !paths.is_empty() => { + FileName::Real(v.canonicalize().unwrap_or_else(|_| v.to_path_buf())) + } + _ => base.clone(), }; match config {