@@ -42,7 +42,7 @@ type Options = {
4242
4343const react = ( _options ?: Options ) : PluginOption [ ] => {
4444 const options = {
45- jsxImportSource : _options ?. jsxImportSource ,
45+ jsxImportSource : _options ?. jsxImportSource ?? "react" ,
4646 tsDecorators : _options ?. tsDecorators ,
4747 plugins : _options ?. plugins
4848 ? _options ?. plugins . map ( ( el ) : typeof el => [ resolve ( el [ 0 ] ) , el [ 1 ] ] )
@@ -55,7 +55,9 @@ const react = (_options?: Options): PluginOption[] => {
5555 apply : "serve" ,
5656 config : ( ) => ( {
5757 esbuild : false ,
58- optimizeDeps : { include : [ "react/jsx-dev-runtime" ] } ,
58+ optimizeDeps : {
59+ include : [ `${ options . jsxImportSource } /jsx-dev-runtime` ] ,
60+ } ,
5961 } ) ,
6062 resolveId : ( id ) => ( id === runtimePublicPath ? id : undefined ) ,
6163 load : ( id ) =>
@@ -80,7 +82,7 @@ const react = (_options?: Options): PluginOption[] => {
8082 development : true ,
8183 useBuiltins : true ,
8284 runtime : "automatic" ,
83- importSource : options ? .jsxImportSource ,
85+ importSource : options . jsxImportSource ,
8486 } ) ;
8587 if ( ! result ) return ;
8688
@@ -123,7 +125,7 @@ const react = (_options?: Options): PluginOption[] => {
123125 transformWithOptions ( _id . split ( "?" ) [ 0 ] , code , options , {
124126 useBuiltins : true ,
125127 runtime : "automatic" ,
126- importSource : options ? .jsxImportSource ,
128+ importSource : options . jsxImportSource ,
127129 } ) ,
128130 }
129131 : {
@@ -132,7 +134,7 @@ const react = (_options?: Options): PluginOption[] => {
132134 config : ( ) => ( {
133135 esbuild : {
134136 jsx : "automatic" ,
135- jsxImportSource : options ? .jsxImportSource ,
137+ jsxImportSource : options . jsxImportSource ,
136138 tsconfigRaw : {
137139 compilerOptions : { useDefineForClassFields : true } ,
138140 } ,
0 commit comments