Deploying a SvelteKit SPA to Azure Static Web Apps

Deploying a SvelteKit SPA to Azure Static Web Apps

As of the time of writing, these are the steps I have taken to deploy my SvelteKit web app as an SPA to ASWA:

1. Use adapter-static in lieu of adapter-auto

npm install -D @sveltejs/adapter-static

2. Modify svelte.config.js

Swap out adapter-auto for adapter-static. Set config.kit.adapter such that the config file resembles mine below:

import preprocess from "svelte-preprocess";

/** @type {import('@sveltejs/kit').Config} */
const config = {
    preprocess: [
        preprocess({
            postcss: true,
        }),
    ],
    kit: {
        adapter: adapter({
            pages: 'build',
            assets: 'build',
            fallback: 'index.html'
        }),
        prerender: { entries: [] }
    }
};

export default config;