Skip to content

Commit

Permalink
perf(core): skip transform files in node_modules (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn authored Jul 15, 2024
1 parent 3b0d0a4 commit 0ed2c19
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,15 @@ fn transform_output(url: String, output: LoadFnOutput) -> Result<LoadFnOutput> {
}
Some(Either4::A(_) | Either4::B(_) | Either4::C(_)) => {
let src_path = Path::new(&url);
if env::var("OXC_TRANSFORM_ALL").is_err()
&& src_path
.to_str()
.map(|p| p.contains(NODE_MODULES_PATH))
.unwrap_or(false)
{
tracing::debug!("Skip transforming node_modules {}", url);
return Ok(output);
}
let ext = src_path.extension().and_then(|ext| ext.to_str());
let jsx = ext
.map(|ext| ext == "tsx" || ext == "jsx")
Expand Down

0 comments on commit 0ed2c19

Please sign in to comment.