Gum Rick
Gum Rick

Reputation: 255

Deploy static Svelte-Kit app with AWS Amplify

I'm trying to deploy my Svelte app on AWS Amplify, I push the commits, Amplify builds and verifies the app, but then if I visit the app URL it's just a blank page, it might be an adapter problem? I tried the node.js and static ones but no luck

Upvotes: 5

Views: 4465

Answers (2)

Gum Rick
Gum Rick

Reputation: 255

In the end, this solved the problem:

svelte.config.js

import adapter from '@sveltejs/adapter-static';

/** @type {import('@sveltejs/kit').Config} */
const config = {
    kit: {
        adapter: adapter(),
        prerender: {
            default: true
        }
    }
};

export default config;

Upvotes: 5

Mark
Mark

Reputation: 7625

If you want to deploy a Sveltekit application to AWS Amplify. You need to use the @sveltejs/adapter-static, since it will serve your app via a static CDN.

Once you change the adapter, make sure to add a fallback in svelte.config.js:

// svelte.config.js
import adapter from '@sveltejs/adapter-static';

export default {
  kit: {
    adapter: adapter({
      fallback: 'index.html'
    })
  }
};

Upvotes: 5

Related Questions