Incremental Static Regeneration (ISR) with SvelteKit

Developer preview

This feature is in developer preview. Use with caution as it may change unexpectedly. For more information, contact us.

For Vercel deployments, enable ISR to cache and revalidate pages:

// src/routes/[...path]/+page.server.ts import { createVercelIsrConfig } from '@uniformdev/canvas-sveltekit'; export const config = createVercelIsrConfig({ expiration: 60, // Revalidate every 60 seconds });

Pass the Vercel adapter to the SvelteKit plugin in vite.config.ts. Install @sveltejs/adapter-vercel first.

// vite.config.ts import adapter from '@sveltejs/adapter-vercel'; import { sveltekit } from '@sveltejs/kit/vite'; import { defineConfig } from 'vite'; export default defineConfig({ plugins: [ sveltekit({ adapter: adapter(), }), ], });