Skip to content
Latchkey

vite build for SvelteKit and svelte-check

A SvelteKit production build runs vite build, which invokes the configured adapter; svelte-check is the separate typecheck gate.

SvelteKit does not have its own build binary: vite build is the build command, and the adapter decides the output. svelte-check covers types in .svelte files.

What it does

For SvelteKit, vite build compiles the app and runs the adapter (adapter-node, adapter-static, adapter-auto, or a platform adapter) to shape the output. svelte-check runs the language-server diagnostics over Svelte components and TypeScript.

Common usage

Terminal
vite build
# typecheck gate
svelte-check --tsconfig ./tsconfig.json
# scaffolded scripts usually expose
npm run build    # -> vite build
npm run check    # -> svelte-check

Options

Command / FlagWhat it does
vite buildBuild the SvelteKit app (runs the adapter)
svelte-checkType/diagnostic check of .svelte and .ts files
--tsconfig <f>tsconfig for svelte-check
--fail-on-warningsMake svelte-check exit non-zero on warnings
(adapter)Chosen in svelte.config.js, decides output shape

In CI

Install the adapter that matches your host (adapter-node for a Node server, adapter-static for a static site) or the default adapter-auto may not detect the platform. Run svelte-check as a distinct step since vite build does not type-check Svelte components.

Common errors in CI

"Error: Cannot find package \"@sveltejs/adapter-...\"" means the adapter in svelte.config.js is not installed. "adapter-auto could not detect a supported environment" means you need to install a specific adapter. svelte-check prints diagnostics ending in a summary line and exits non-zero when errors exist; "prerendering failed" during build usually comes from a route fetching missing data.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →