Skip to content

Commit

Permalink
chore: no node_modules condition
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Apr 23, 2024
1 parent c80164d commit d4695e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/mako/src/plugins/invalid_webpack_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ impl Plugin for InvalidWebpackSyntaxPlugin {
"react-server-dom-webpack".to_string(),
];
pkgs.extend(context.config.experimental.webpack_syntax_validate.clone());
if param.path.contains("node_modules") && pkgs.iter().any(|pkg| param.path.contains(pkg)) {
// TODO: 这里的判断并不严谨,只是简单判断了路径是否包含 pkg
// 由于要考虑 monorepo 的场景,不能直接通过 contains('node_modules') 来判断是否为三方包
if pkgs.iter().any(|pkg| param.path.contains(pkg)) {
return Ok(());
}
ast.visit_with(&mut InvalidSyntaxVisitor {
Expand Down

0 comments on commit d4695e3

Please sign in to comment.