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.cjs
const node = require('@sveltejs/adapter-node');
module.exports = {
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.cjs
const node = require('@sveltejs/adapter-node');
module.exports = {
kit: {
- adapter: node()
+ adapter: node({ out: 'my-output-directory' })
}
};
A variety of official adapters exist for serverless platforms...
adapter-begin
— for begin.comadapter-netlify
— for netlify.comadapter-vercel
— for vercel.com
...and others:
adapter-node
— for creating self-contained Node appsadapter-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.