Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 1.85 KB

10-adapters.md

File metadata and controls

46 lines (34 loc) · 1.85 KB
title
Adapters

Before you can deploy your SvelteKit app, you need to adapt it for your deployment target. Adapters are small plugins that take the built app as input and generate output that is optimised for a specific platform.

For example, if you want to run your app as a simple Node server, you would use the @sveltejs/adapter-node package:

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

export default {
	kit: {
		adapter: node()
	}
};

With this, svelte-kit build will generate a self-contained Node app inside build. You can pass options to adapters, such as customising the output directory in adapter-node:

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

export default {
	kit: {
-		adapter: node()
+		adapter: node({ out: 'my-output-directory' })
	}
};

A variety of official adapters exist for serverless platforms...

...and others:

  • adapter-node — for creating self-contained Node apps
  • adapter-static — for prerendering your entire site as a collection of static files

The adapter API is still in flux and will likely change before 1.0.