Skip to main content
The @sveltejs/adapter-netlify adapter deploys your SvelteKit app to Netlify.

Installation

Usage

Add the adapter to your svelte.config.js:

Configuration options

From the adapter type definitions:

split

If true, creates a separate Netlify function for each route. This can improve cold start times but may hit function limits on large sites.
From the implementation:

edge

Deploys to Netlify Edge Functions instead of serverless functions. Edge Functions run on Deno at the edge, closer to your users.
You cannot use both split: true and edge: true together. Edge Functions do not support splitting.

Netlify configuration

Create a netlify.toml file to configure your deployment:
The adapter automatically detects the publish directory from netlify.toml:

Custom headers and redirects

You can add custom headers and redirects by creating _headers and _redirects files in your project root:
The adapter preserves these files and adds SvelteKit-generated headers:
Place _headers and _redirects in your project root, not in the static directory. The adapter will throw an error if they’re in the wrong location.

Platform context

Netlify provides a context object with request and environment information:

Build output

The adapter generates different output based on your configuration:

Deployment

1

Build locally

2

Deploy

Environment variables

Set environment variables in the Netlify UI or via netlify.toml:
Access them in your app:
Netlify automatically sets NETLIFY=true during builds, which is how adapter-auto detects the Netlify environment.

Edge Functions vs Serverless

Edge Functions run on Deno, not Node.js. Some Node.js-specific packages may not work. Test thoroughly before deploying.