0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00

[ci] format

This commit is contained in:
Matthew Phillips 2024-05-07 17:13:57 +00:00 committed by astrobot-houston
parent d47baa466a
commit cceeafb62a

View file

@ -21,16 +21,16 @@ const versionsConfig = {
18: {
server: '@astrojs/react/server.js',
client: '@astrojs/react/client.js',
externals: ['react-dom/server', 'react-dom/client']
externals: ['react-dom/server', 'react-dom/client'],
},
19: {
server: '@astrojs/react/server.js',
client: '@astrojs/react/client.js',
externals: ['react-dom/server', 'react-dom/client']
}
externals: ['react-dom/server', 'react-dom/client'],
},
};
type SupportedReactVersion = keyof (typeof versionsConfig);
type SupportedReactVersion = keyof typeof versionsConfig;
type ReactVersionConfig = (typeof versionsConfig)[SupportedReactVersion];
function getReactMajorVersion(): number {
@ -75,12 +75,10 @@ function optionsPlugin(experimentalReactChildren: boolean): vite.Plugin {
};
}
function getViteConfiguration({
include,
exclude,
babel,
experimentalReactChildren,
}: ReactIntegrationOptions = {}, reactConfig: ReactVersionConfig) {
function getViteConfiguration(
{ include, exclude, babel, experimentalReactChildren }: ReactIntegrationOptions = {},
reactConfig: ReactVersionConfig
) {
return {
optimizeDeps: {
include: [
@ -90,9 +88,7 @@ function getViteConfiguration({
'react/jsx-dev-runtime',
'react-dom',
],
exclude: [
reactConfig.server,
],
exclude: [reactConfig.server],
},
plugins: [react({ include, exclude, babel }), optionsPlugin(!!experimentalReactChildren)],
resolve: {
@ -130,7 +126,10 @@ export default function ({
'astro:config:setup': ({ command, addRenderer, updateConfig, injectScript }) => {
addRenderer(getRenderer(versionConfig));
updateConfig({
vite: getViteConfiguration({ include, exclude, babel, experimentalReactChildren }, versionConfig),
vite: getViteConfiguration(
{ include, exclude, babel, experimentalReactChildren },
versionConfig
),
});
if (command === 'dev') {
const preamble = FAST_REFRESH_PREAMBLE.replace(`__BASE__`, '/');