From b46815a684a13ff3b364b2913c18acf57afbbac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 5 Jan 2023 19:07:45 +0900 Subject: [PATCH] fix(es): Fix wasm (#6755) --- crates/swc/src/config/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/swc/src/config/mod.rs b/crates/swc/src/config/mod.rs index 501388474a3a..71b020eef948 100644 --- a/crates/swc/src/config/mod.rs +++ b/crates/swc/src/config/mod.rs @@ -1309,9 +1309,11 @@ impl ModuleConfig { available_features: FeatureFlag, ) -> Box { let base = match base { - FileName::Real(path) if !paths.is_empty() && !path.is_absolute() => { - FileName::Real(std::env::current_dir().unwrap().join(path)) - } + FileName::Real(path) if !paths.is_empty() && !path.is_absolute() => FileName::Real( + std::env::current_dir() + .map(|v| v.join(path)) + .unwrap_or_else(|_| path.to_path_buf()), + ), _ => base.to_owned(), };