Skip to content


SvelteKit is a meta framework for Svelte. Learn more about SvelteKit at This guide is accurate as of SvelteKit 2.5.7 / Svelte 4.2.15.


  • Use SSG and/or SPA via static-adapter. Tauri doesn’t support server-based solutions.
  • Use build/ as frontendDist in tauri.conf.json.

Example Configuration

  1. npm install --save-dev @sveltejs/adapter-static
  2. tauri.conf.json
    "build": {
    "beforeDevCommand": "npm run dev",
    "beforeBuildCommand": "npm run build",
    "devUrl": "http://localhost:5173",
    "frontendDist": "../build"
  3. Update SvelteKit configuration:
    import adapter from '@sveltejs/adapter-static';
    import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
    /** @type {import('@sveltejs/kit').Config} */
    const config = {
    // Consult
    // for more information about preprocessors
    preprocess: vitePreprocess(),
    kit: {
    adapter: adapter(),
    export default config;
  4. Disable SSR

    Lastly, we need to disable SSR and enable prerendering by adding a root +layout.ts file (or +layout.js if you are not using TypeScript) with these contents:

    export const prerender = true;
    export const ssr = false;

    Note that static-adapter doesn’t require you to disable SSR for the whole app but it makes it possible to use APIs that depend on the global window object (like Tauri’s API) without Client-side checks.

    Furthermore, if you prefer Single-Page Application (SPA) mode over SSG, you can change the adapter configurations and +layout.ts according to the adapter docs.

© 2024 Tauri Contributors. CC-BY / MIT