Search code examples
deploymentsveltelamp

Svelte application deployment


I have more or less finished my site development with Svelte.

I would deploy it to my own VPS, which will be using a typical LAMP setup.

I followed the doc and made the changes in svelte.config.js:

import adapter from "@sveltejs/adapter-static";
import { vitePreprocess } from "@sveltejs/kit/vite";

/** @type {import('@sveltejs/kit').Config} */
const config = {
  ...
  kit: {
    adapter: adapter({
      fallback: '404.html'
    }),
  },
};

Then I ran npm run build, it seems no error but I found the following files/directories under build:

build dir

I think it is not right because there is no entry file to load all the stuffs...

Am I doing it correctly?


Solution

  • Change fallback to 'index.html' or the appropriate entry point name depending on your server.

    As mentioned in the svelte Docs:

    The fallback page is an HTML page created by SvelteKit from your page template (e.g. app.html) that loads your app and navigates to the correct route.