diff --git a/packages/start/src/config/index.ts b/packages/start/src/config/index.ts index 7efef1fb3d..f371997c8e 100644 --- a/packages/start/src/config/index.ts +++ b/packages/start/src/config/index.ts @@ -2,7 +2,7 @@ import path from 'node:path' import { existsSync, readFileSync } from 'node:fs' import { readFile } from 'node:fs/promises' import { fileURLToPath } from 'node:url' -import reactRefresh from '@vitejs/plugin-react' +import viteReact from '@vitejs/plugin-react' import { resolve } from 'import-meta-resolve' import { TanStackRouterVite } from '@tanstack/router-plugin/vite' import { @@ -173,11 +173,7 @@ export function defineConfig( serverFunctions.client({ runtime: '@tanstack/start/client-runtime', }), - reactRefresh({ - babel: opts.react?.babel, - exclude: opts.react?.exclude, - include: opts.react?.include, - }), + viteReact(opts.react), // TODO: RSCS - enable this // serverComponents.client(), ] diff --git a/packages/start/src/config/schema.ts b/packages/start/src/config/schema.ts index af62c095ba..dd38a57890 100644 --- a/packages/start/src/config/schema.ts +++ b/packages/start/src/config/schema.ts @@ -3,7 +3,7 @@ import { z } from 'zod' import type { PluginOption } from 'vite' import type { AppOptions as VinxiAppOptions } from 'vinxi' import type { NitroOptions } from 'nitropack' - +import type { Options as ViteReactOptions } from '@vitejs/plugin-react' import type { CustomizableConfig } from 'vinxi/dist/types/lib/vite-dev' type StartUserViteConfig = CustomizableConfig | (() => CustomizableConfig) @@ -138,17 +138,7 @@ export const serverSchema = z const viteSchema = z.custom() -const babelSchema = z.object({ - plugins: z - .array(z.union([z.tuple([z.string(), z.any()]), z.string()])) - .optional(), -}) - -const reactSchema = z.object({ - babel: babelSchema.optional(), - exclude: z.array(z.instanceof(RegExp)).optional(), - include: z.array(z.instanceof(RegExp)).optional(), -}) +const viteReactSchema = z.custom() const routersSchema = z.object({ ssr: z @@ -192,7 +182,7 @@ const tsrConfig = configSchema.partial().extend({ }) export const inlineConfigSchema = z.object({ - react: reactSchema.optional(), + react: viteReactSchema.optional(), vite: viteSchema.optional(), tsr: tsrConfig.optional(), routers: routersSchema.optional(),