Vite plugin for SSR and SSG across multiple frameworks (React, Preact, Vue). Current stable version is 1.4.1 (March 2021). Release cadence is irregular with minor feature releases and bug fixes. Key differentiators: declarative entry point, automatic page generation, preview in both SSR and CSR, convenient init script. Compared to vite-ssr and vite-ssg, it aims for cross-framework support and simpler CLI commands. Last release was over a year ago, so it's in maintenance mode.
npm install vite-plugin-ssr-ssgVerified import paths — ran on the pinned version, not inferred.
Configuration example with React: sets up Vite with the plugin and defines static routes for SSG.
Use `import` syntax in all files. Set `"type": "module"` in package.json or use `.mjs` extension.
Run `yarn vite-ssrg init` or `npx vite-ssrg init`.
Update any custom rollup configuration in vite.config.ts to use ESM format.
If using Preact, update imports to `import { h } from 'preact/compat'` or configure plugin with preactCompat option.Remove `routes` from plugin options and rely on automatic detection.
Install the package: `npm install vite-plugin-ssr-ssg`. Ensure Node >=12 and your project uses ESM (`"type": "module"` in package.json).
Use `import vitePluginSsrSsg from 'vite-plugin-ssr-ssg'` (default import).
Upgrade Vite to >=2.0.0.