Skip to content

Commit

Permalink
fix(rspack_loader_swc): Fail the build when jsc.target and env are us…
Browse files Browse the repository at this point in the history
…ed together for the SWC loader (#4257)

fix(rspack_loader_swc): jsc.target and env shouldn't be used together
  • Loading branch information
Hamzakh777 authored Sep 27, 2023
1 parent 9b26fc8 commit 143f21b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/rspack_loader_swc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ impl Loader<LoaderRunnerContext> 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(|| {
Expand Down

0 comments on commit 143f21b

Please sign in to comment.