@sveltejs/adapter-netlify adapter deploys your SvelteKit app to Netlify.
Installation
Usage
Add the adapter to yoursvelte.config.js:
Configuration options
From the adapter type definitions:split
Iftrue, creates a separate Netlify function for each route. This can improve cold start times but may hit function limits on large sites.
edge
Deploys to Netlify Edge Functions instead of serverless functions. Edge Functions run on Deno at the edge, closer to your users.Netlify configuration
Create anetlify.toml file to configure your deployment:
netlify.toml:
Custom headers and redirects
You can add custom headers and redirects by creating_headers and _redirects files in your project root:
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 acontext 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 vianetlify.toml: