vite.config.ts
vite.config.ts is the configuration entrypoint for a SolidStart v2 application. It replaces v1's app.config.ts.
import { nitro } from "nitro/vite";import { defineConfig } from "vite";import { solidStart } from "@solidjs/start/config";
export default defineConfig({ plugins: [solidStart(), nitro()],});Responsibilities
- Pass application, routing, middleware, environment, and serialization settings to
solidStart(). - Add ordinary Vite plugins and options at the Vite config level.
- Pass server, deployment, prerendering, task, and WebSocket settings through the top-level
nitroproperty.
import { nitro } from "nitro/vite";import { defineConfig } from "vite";import { solidStart } from "@solidjs/start/config";
export default defineConfig({ plugins: [ solidStart({ middleware: "./src/middleware/index.ts", serialization: { mode: "json" }, }), nitro(), ], nitro: { preset: "node_server", prerender: { routes: ["/"], }, },});SolidStart v2 requires Vite 8 or 9. The default scripts are vite dev and vite build; vite preview locally serves a completed production build.
For the available server options and deployment presets, see the Nitro configuration reference.