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...
adapter-begin
— for Beginadapter-cloudflare-workers
— for Cloudflare Workersadapter-netlify
— for Netlifyadapter-vercel
— for Vercel
...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.