@sveltejs/adapter-cloudflare adapter deploys your SvelteKit app to Cloudflare Workers with static assets or Cloudflare Pages.
Installation
Usage
Add the adapter to yoursvelte.config.js:
Configuration options
From the adapter type definitions:config
Path to your Wrangler configuration file.fallback
Controls how 404 errors are handled:'plaintext'(default): Returns a simple “Not Found” text response'spa': Generates a SPA fallback page for client-side routing
routes
Only for Cloudflare Pages. Customizes the automatically-generated_routes.json file that controls routing.
The placeholders
<build>, <files>, <prerendered>, and <all> are automatically expanded by the adapter.platformProxy
Configuration passed to Wrangler’sgetPlatformProxy during development:
Wrangler configuration
Create awrangler.toml file in your project root:
Environment bindings
Access Cloudflare bindings via theplatform.env object:
wrangler.toml:
Platform object
Theplatform object provides access to Cloudflare-specific APIs:
Generated files
The adapter generates several Cloudflare-specific files:Deployment
1
Build your app
2
Deploy to Cloudflare