diff --git a/crates/rspack_loader_swc/src/lib.rs b/crates/rspack_loader_swc/src/lib.rs index ef186a0c488..9e5392e1d46 100644 --- a/crates/rspack_loader_swc/src/lib.rs +++ b/crates/rspack_loader_swc/src/lib.rs @@ -85,6 +85,15 @@ impl Loader for SwcLoader { )); } + if swc_options.config.jsc.target.is_some() && swc_options.config.env.is_some() { + loader_context.emit_diagnostic(Diagnostic::warn( + SWC_LOADER_IDENTIFIER.to_string(), + "`env` and `jsc.target` cannot be used together".to_string(), + 0, + 0, + )); + } + GLOBALS.set(&Default::default(), || { try_with_handler(c.cm.clone(), Default::default(), |handler| { c.run(|| {