@@ -3,7 +3,7 @@ import type { AstroIntegration } from 'astro';
3
3
import { version as ReactVersion } from 'react-dom' ;
4
4
import type * as vite from 'vite' ;
5
5
6
- export type ReactIntegrationOptions = Pick < ViteReactPluginOptions , 'include' | 'exclude' > & {
6
+ export type ReactIntegrationOptions = Pick < ViteReactPluginOptions , 'include' | 'exclude' | 'babel' > & {
7
7
experimentalReactChildren ?: boolean ;
8
8
} ;
9
9
@@ -46,6 +46,7 @@ function optionsPlugin(experimentalReactChildren: boolean): vite.Plugin {
46
46
function getViteConfiguration ( {
47
47
include,
48
48
exclude,
49
+ babel,
49
50
experimentalReactChildren,
50
51
} : ReactIntegrationOptions = { } ) {
51
52
return {
@@ -65,7 +66,7 @@ function getViteConfiguration({
65
66
: '@astrojs/react/server-v17.js' ,
66
67
] ,
67
68
} ,
68
- plugins : [ react ( { include, exclude } ) , optionsPlugin ( ! ! experimentalReactChildren ) ] ,
69
+ plugins : [ react ( { include, exclude, babel } ) , optionsPlugin ( ! ! experimentalReactChildren ) ] ,
69
70
resolve : {
70
71
dedupe : [ 'react' , 'react-dom' , 'react-dom/server' ] ,
71
72
} ,
@@ -89,6 +90,7 @@ function getViteConfiguration({
89
90
export default function ( {
90
91
include,
91
92
exclude,
93
+ babel,
92
94
experimentalReactChildren,
93
95
} : ReactIntegrationOptions = { } ) : AstroIntegration {
94
96
return {
@@ -97,7 +99,7 @@ export default function ({
97
99
'astro:config:setup' : ( { command, addRenderer, updateConfig, injectScript } ) => {
98
100
addRenderer ( getRenderer ( ) ) ;
99
101
updateConfig ( {
100
- vite : getViteConfiguration ( { include, exclude, experimentalReactChildren } ) ,
102
+ vite : getViteConfiguration ( { include, exclude, babel , experimentalReactChildren } ) ,
101
103
} ) ;
102
104
if ( command === 'dev' ) {
103
105
const preamble = FAST_REFRESH_PREAMBLE . replace ( `__BASE__` , '/' ) ;
0 commit comments