Vite
vite:
client:
configFile: vite.config.js
override:
build:
sourcemap: true
ssr:
configFile: vite.config.jsMost projects do not need a vite block. Add it when the browser client build and SSR build need separate config files or targeted overrides.
Vite Settings
- vite.client.configFile
- Vite config used for the browser client build.
- vite.client.override
- Inline config merged into the client Vite config.
- vite.ssr.configFile
- Vite config used for SSR component compilation.
- vite.ssr.override
- Inline config merged into the SSR Vite config.
vite.client.configFile
vite.client.configFile points to the Vite config used for browser builds. App loads Vite from the target project, so your normal project Vite config remains the source of plugin and build behavior.
import { svelte } from "@sveltejs/vite-plugin-svelte";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [svelte()]
});vite.client.override
vite.client.override is merged into the browser build config after the config file loads. Use it for small project-specific differences without creating a second Vite file.
vite.ssr.configFile
vite.ssr.configFile points to the Vite config used when Forge compiles Svelte for server-side rendering. It can share the client config when both builds use the same plugins.
vite.ssr.override
vite.ssr.override is merged into the SSR Vite config. Use it when server-side compilation needs a different option from the browser bundle.