@@ -107,15 +107,19 @@ export async function transformWithOxc(
107
107
}
108
108
109
109
switch ( loadedCompilerOptions . jsx ) {
110
- case 'react-jsxdev' :
111
- jsxOptions . runtime = 'automatic'
112
- jsxOptions . development = true
113
- break
114
110
case 'react' :
115
111
jsxOptions . runtime = 'classic'
112
+ // this option should not be set when using classic runtime
113
+ jsxOptions . importSource = undefined
116
114
break
115
+ case 'react-jsxdev' :
116
+ jsxOptions . development = true
117
+ // eslint-disable-next-line no-fallthrough
117
118
case 'react-jsx' :
118
119
jsxOptions . runtime = 'automatic'
120
+ // these options should not be set when using automatic runtime
121
+ jsxOptions . pragma = undefined
122
+ jsxOptions . pragmaFrag = undefined
119
123
break
120
124
default :
121
125
break
@@ -563,9 +567,18 @@ export function convertEsbuildConfigToOxcConfig(
563
567
switch ( esbuildTransformOptions . jsx ) {
564
568
case 'automatic' :
565
569
jsxOptions . runtime = 'automatic'
570
+ if ( esbuildTransformOptions . jsxImportSource ) {
571
+ jsxOptions . importSource = esbuildTransformOptions . jsxImportSource
572
+ }
566
573
break
567
574
case 'transform' :
568
575
jsxOptions . runtime = 'classic'
576
+ if ( esbuildTransformOptions . jsxFactory ) {
577
+ jsxOptions . pragma = esbuildTransformOptions . jsxFactory
578
+ }
579
+ if ( esbuildTransformOptions . jsxFragment ) {
580
+ jsxOptions . pragmaFrag = esbuildTransformOptions . jsxFragment
581
+ }
569
582
break
570
583
default :
571
584
break
@@ -574,15 +587,6 @@ export function convertEsbuildConfigToOxcConfig(
574
587
if ( esbuildTransformOptions . jsxDev ) {
575
588
jsxOptions . development = true
576
589
}
577
- if ( esbuildTransformOptions . jsxFactory ) {
578
- jsxOptions . pragma = esbuildTransformOptions . jsxFactory
579
- }
580
- if ( esbuildTransformOptions . jsxFragment ) {
581
- jsxOptions . pragmaFrag = esbuildTransformOptions . jsxFragment
582
- }
583
- if ( esbuildTransformOptions . jsxImportSource ) {
584
- jsxOptions . importSource = esbuildTransformOptions . jsxImportSource
585
- }
586
590
587
591
oxcOptions . jsx = jsxOptions
588
592
}
0 commit comments