Support for React Router v7
By Steven Van ·
Server-rendered and SPA-mode React Router v7 apps deploy with zero config, and a Vercel preset adds bundle splitting and per-route function settings.
Vercel now supports React Router v7 applications when used as a framework, including server-rendered apps that run on Vercel's Fluid compute. The React Router on Vercel docs cover setup for both SSR and static output (SPA mode), with zero configuration.
Adding the Vercel preset from @vercel/react-router/vite to react-router.config.ts enables the fuller feature set on Vercel:
- The preset splits application bundles across Vercel Functions, based on the app's routing structure.
- Function-level settings such as memory and maxDuration can be set per route.
- The deployment details page shows an accurate "Deployment Summary".
- Custom server entry points are supported, for example a Hono server that supplies a load context to loaders and actions.
Response streaming works through Vercel Functions, and a custom entry.server file can use the handleRequest function from @vercel/react-router/entry.server. Cache-Control headers set in a route's headers export control caching on Vercel's CDN, and Vercel Analytics can be added with the @vercel/analytics package.