Skip to content

Commit

Permalink
Fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisl9029 committed May 25, 2023
1 parent 72972b3 commit 066db67
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 0 additions & 2 deletions crates/swc/tests/reflame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions crates/swc_ecma_loader/src/resolvers/tsc.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
6 changes: 5 additions & 1 deletion crates/swc_ecma_transforms_module/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 066db67

Please sign in to comment.