@@ -87,45 +87,47 @@ export async function transformWithOxc(
8787 ensureWatchedFile ( watcher , tsconfigFile , config . root )
8888 }
8989 const loadedCompilerOptions = loadedTsconfig . compilerOptions ?? { }
90- // tsc compiler experimentalDecorators/target/useDefineForClassFields
90+ // TODO: experimentalDecorators
9191
92- if ( loadedCompilerOptions . jsx === 'preserve' ) {
93- resolvedOptions . jsx = 'preserve'
94- } else {
95- const jsxOptions = {
96- ...( resolvedOptions . jsx === 'preserve' ? { } : resolvedOptions . jsx ) ,
97- }
92+ // when both the normal options and tsconfig is set,
93+ // we want to prioritize the normal options
94+ if ( resolvedOptions . jsx === undefined ) {
95+ if ( loadedCompilerOptions . jsx === 'preserve' ) {
96+ resolvedOptions . jsx = 'preserve'
97+ } else {
98+ const jsxOptions : OxcJsxOptions = { }
9899
99- if ( loadedCompilerOptions . jsxFactory ) {
100- jsxOptions . pragma = loadedCompilerOptions . jsxFactory
101- }
102- if ( loadedCompilerOptions . jsxFragmentFactory ) {
103- jsxOptions . pragmaFrag = loadedCompilerOptions . jsxFragmentFactory
104- }
105- if ( loadedCompilerOptions . jsxImportSource ) {
106- jsxOptions . importSource = loadedCompilerOptions . jsxImportSource
107- }
100+ if ( loadedCompilerOptions . jsxFactory ) {
101+ jsxOptions . pragma = loadedCompilerOptions . jsxFactory
102+ }
103+ if ( loadedCompilerOptions . jsxFragmentFactory ) {
104+ jsxOptions . pragmaFrag = loadedCompilerOptions . jsxFragmentFactory
105+ }
106+ if ( loadedCompilerOptions . jsxImportSource ) {
107+ jsxOptions . importSource = loadedCompilerOptions . jsxImportSource
108+ }
108109
109- switch ( loadedCompilerOptions . jsx ) {
110- case 'react' :
111- jsxOptions . runtime = 'classic'
112- // this option should not be set when using classic runtime
113- jsxOptions . importSource = undefined
114- break
115- case 'react-jsxdev' :
116- jsxOptions . development = true
117- // eslint-disable-next-line no-fallthrough
118- case 'react-jsx' :
119- jsxOptions . runtime = 'automatic'
120- // these options should not be set when using automatic runtime
121- jsxOptions . pragma = undefined
122- jsxOptions . pragmaFrag = undefined
123- break
124- default :
125- break
126- }
110+ switch ( loadedCompilerOptions . jsx ) {
111+ case 'react' :
112+ jsxOptions . runtime = 'classic'
113+ // this option should not be set when using classic runtime
114+ jsxOptions . importSource = undefined
115+ break
116+ case 'react-jsxdev' :
117+ jsxOptions . development = true
118+ // eslint-disable-next-line no-fallthrough
119+ case 'react-jsx' :
120+ jsxOptions . runtime = 'automatic'
121+ // these options should not be set when using automatic runtime
122+ jsxOptions . pragma = undefined
123+ jsxOptions . pragmaFrag = undefined
124+ break
125+ default :
126+ break
127+ }
127128
128- resolvedOptions . jsx = jsxOptions
129+ resolvedOptions . jsx = jsxOptions
130+ }
129131 }
130132
131133 /**
0 commit comments