A Vite plugin for server-side rendering (SSR) that follows the Unix philosophy of doing one thing well. Current stable version is 0.4.142. It provides a lightweight, framework-agnostic SSR solution for Vite, unlike full-featured meta-frameworks like Next.js or Nuxt. It supports file-based routing, data fetching, and hydration. The plugin is actively maintained with frequent releases. Key differentiators: it is a simple Vite plugin rather than a full framework, supports any frontend framework (React, Vue, Svelte, etc.), and integrates seamlessly with existing Vite setups. Requires Node >=16, Vite >=3.1.0, and react-streaming >=0.3.5 (for React).
npm install vite-plugin-ssrVerified import paths — ran on the pinned version, not inferred.
Basic SSR setup with React: plugin configuration, a page component, and a server-side render function.
Update imports: use import { vitePluginSsr } from 'vite-plugin-ssr/plugin' instead of 'vite-plugin-ssr'Import PageContext from 'vite-plugin-ssr/types' instead of 'vite-plugin-ssr'
Use async function render(pageContext) with explicit return of { pageHtml } or similarUpdate Vite to >=3.1.0 and Node to >=16
Run npm install react-streaming
Install latest version and use import { vitePluginSsr } from 'vite-plugin-ssr/plugin'Use import { vitePluginSsr } from 'vite-plugin-ssr/plugin' (curly braces)Import PageContext from 'vite-plugin-ssr/types' and ensure version >=0.4.0
Upgrade Vite to >=3.1.0