Skip to content

Commit 9afe6f6

Browse files
committed
fix(oxc): set typescript jsx options
1 parent 9a4ab2d commit 9afe6f6

File tree

1 file changed

+6
-0
lines changed
  • packages/vite/src/node/plugins

1 file changed

+6
-0
lines changed

packages/vite/src/node/plugins/oxc.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,15 @@ export function setOxcTransformOptionsFromTsconfigOptions(
7171
}
7272
if (oxcOptions.jsx !== 'preserve') {
7373
const jsxOptions: OxcJsxOptions = { ...oxcOptions.jsx }
74+
const typescriptOptions = { ...oxcOptions.typescript }
7475

7576
if (tsCompilerOptions.jsxFactory) {
7677
jsxOptions.pragma ??= tsCompilerOptions.jsxFactory
78+
typescriptOptions.jsxPragma = jsxOptions.pragma
7779
}
7880
if (tsCompilerOptions.jsxFragmentFactory) {
7981
jsxOptions.pragmaFrag ??= tsCompilerOptions.jsxFragmentFactory
82+
typescriptOptions.jsxPragmaFrag = jsxOptions.pragmaFrag
8083
}
8184
if (tsCompilerOptions.jsxImportSource) {
8285
jsxOptions.importSource ??= tsCompilerOptions.jsxImportSource
@@ -96,14 +99,17 @@ export function setOxcTransformOptionsFromTsconfigOptions(
9699
jsxOptions.runtime = 'automatic'
97100
// these options should not be set when using automatic runtime
98101
jsxOptions.pragma = undefined
102+
typescriptOptions.jsxPragma = undefined
99103
jsxOptions.pragmaFrag = undefined
104+
typescriptOptions.jsxPragmaFrag = undefined
100105
break
101106
default:
102107
break
103108
}
104109
}
105110

106111
oxcOptions.jsx = jsxOptions
112+
oxcOptions.typescript = typescriptOptions
107113
}
108114

109115
if (oxcOptions.decorator?.legacy === undefined) {

0 commit comments

Comments
 (0)