{"id":22851,"library":"vite-plugin-ssr-ssg","title":"vite-plugin-ssr-ssg","description":"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.","status":"maintenance","version":"1.4.1","language":"javascript","source_language":"en","source_url":"https://github.com/TomokiMiyauci/vite-plugin-ssr-ssg","tags":["javascript","vite","vite-plugin","ssr","ssg","vue","react","preact","typescript"],"install":[{"cmd":"npm install vite-plugin-ssr-ssg","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-ssr-ssg","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-ssr-ssg","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core peer dependency; plugin requires Vite >=2.0","package":"vite","optional":false}],"imports":[{"note":"ESM-only package; require() will fail. Use TypeScript with ESM.","wrong":"const vitePluginSsrSsg = require('vite-plugin-ssr-ssg')","symbol":"default","correct":"import vitePluginSsrSsg from 'vite-plugin-ssr-ssg'"},{"note":"defineConfig is a re-exported helper from vite; using vite's directly works but plugin's version provides SSG defaults in v1.2+","wrong":"import { defineConfig } from 'vite'","symbol":"defineConfig","correct":"import { defineConfig } from 'vite-plugin-ssr-ssg'"},{"note":"Options interface is a type-only import in v1.4+. Use `import type` for TS","wrong":"import { VitePluginSsrSsgOptions } from 'vite-plugin-ssr-ssg'","symbol":"VitePluginSsrSsgOptions","correct":"import type { VitePluginSsrSsgOptions } from 'vite-plugin-ssr-ssg'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig, VitePluginSsrSsgOptions } from 'vite-plugin-ssr-ssg';\nimport react from '@vitejs/plugin-react';\n\nconst ssgOptions: VitePluginSsrSsgOptions = {\n  // optional: custom routes for SSG\n  routes: ['/', '/about'],\n};\n\nexport default defineConfig({\n  plugins: [\n    react(),\n    vitePluginSsrSsg(ssgOptions),\n  ],\n});","lang":"typescript","description":"Configuration example with React: sets up Vite with the plugin and defines static routes for SSG."},"warnings":[{"fix":"Use `import` syntax in all files. Set `\"type\": \"module\"` in package.json or use `.mjs` extension.","message":"Plugin uses ESM-only distribution; requires Vite with ESM and Node >=12. CJS imports break.","severity":"gotcha","affected_versions":">=1.4.0"},{"fix":"Run `yarn vite-ssrg init` or `npx vite-ssrg init`.","message":"In v1.3.0, the `init` script changed to use `vite-ssrg init` but older versions used `vite-ssrg-init`.","severity":"deprecated","affected_versions":">=1.3.0 <1.3.0"},{"fix":"Update any custom rollup configuration in vite.config.ts to use ESM format.","message":"v1.4.0 changed rollup config output format; plugins expecting CJS may fail.","severity":"breaking","affected_versions":">=1.4.0"},{"fix":"If using Preact, update imports to `import { h } from 'preact/compat'` or configure plugin with preactCompat option.","message":"Preact import path changed in v1.4.0 from 'preact' to 'preact/compat' to match SSR expectations.","severity":"gotcha","affected_versions":">=1.4.0"},{"fix":"Remove `routes` from plugin options and rely on automatic detection.","message":"The `routes` option in plugin config was deprecated in v1.3.0 in favor of automatic route detection. Manual routes still work but will be removed in v2.","severity":"deprecated","affected_versions":">=1.3.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install the package: `npm install vite-plugin-ssr-ssg`. Ensure Node >=12 and your project uses ESM (`\"type\": \"module\"` in package.json).","cause":"Package is not installed or Node cannot resolve ESM package.","error":"Cannot find module 'vite-plugin-ssr-ssg' or its corresponding type declarations."},{"fix":"Use `import vitePluginSsrSsg from 'vite-plugin-ssr-ssg'` (default import).","cause":"Incorrect import (default vs named) or CJS require used instead of ESM import.","error":"TypeError: vitePluginSsrSsg is not a function"},{"fix":"Upgrade Vite to >=2.0.0.","cause":"Vite version is incompatible (<2.0).","error":"Error: The plugin 'vite-plugin-ssr-ssg' doesn't support the current Vite version"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}