Skip to content

SvelteKit

Deploy a SvelteKit site to LeafCloud.

Validated with Node v24.22.1, SvelteKit 3.1.0, Svelte 5.57.2, Vite 8.3.5, adapter-static 4.0.0, and npm. Configure adapter-static through the SvelteKit Vite plugin and prerender the root layout.

  1. Create a SvelteKit project and install its dependencies:

    Terminal window
    npx sv create app --template minimal --types ts --no-add-ons --no-install < /dev/null
    cd app
    npm install < /dev/null
    npm install -D @sveltejs/adapter-static < /dev/null
  2. In vite.config.ts, import adapter-static and pass it to the SvelteKit plugin. Add prerendering in src/routes/+layout.js:

    import adapter from '@sveltejs/adapter-auto';
    import adapter from '@sveltejs/adapter-static';
    // Keep sveltekit({ adapter: adapter() }) in the Vite plugin options.
    src/routes/+layout.js
    export const prerender = true;
  3. Preview the deployment:

    Terminal window
    leaf deploy --dry-run

    Expected output:

    Framework: SvelteKit (adapter-static)
    Package manager: npm
    Build command: npm run build
    Output directory: build
    Files: 14
    Total size: 88956 bytes
    Dry run: nothing was uploaded.

    A real deploy replaces the final dry-run line with the live URL.

SvelteKit (adapter-static); npm run build; build.

  • Output directory does not exist: <project>/dist — adapter-auto was used without adapter-static. Install @sveltejs/adapter-static and configure it in vite.config.ts.
  • svelte.config.js is no longer used. Please pass configuration via the sveltekit(...) plugin in your Vite config. — remove svelte.config.js and pass the adapter as an option to sveltekit(...) in vite.config.ts.

Run leaf deploy --dry-run --json first. Check the exit code and stop if the JSON contains "error". After a successful dry run, run leaf deploy --json --yes. Never print credentials.

Validated on 2026-10-23 with SvelteKit 3.1.0.