{"id":22783,"library":"vite-plugin-prerender-static","title":"vite-plugin-prerender-static","description":"A lightweight Vite plugin for static prerendering of SPAs to improve SEO. Version 0.1.3 supports Vite 4–7, Node 18+, and multiple routes with built-in SEO meta tag generation (Open Graph, Twitter, JSON-LD). It is framework-agnostic (React, Vue, Svelte, etc.) and requires zero runtime dependencies. Its key differentiator is simplicity: it avoids SSR complexity and provides a drop-in replacement for generating static HTML at build time. The plugin is actively maintained with recent updates and a roadmap for future features like CLI and automatic route discovery.","status":"active","version":"0.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/rahulsushilsharma/vite-plugin-prerender-static","tags":["javascript","vite","vite-plugin","prerender","static-site","seo","ssg","spa","meta-tags","typescript"],"install":[{"cmd":"npm install vite-plugin-prerender-static","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-prerender-static","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-prerender-static","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for Vite plugin integration.","package":"vite","optional":false}],"imports":[{"note":"Default export. Named export will cause undefined error.","wrong":"import { prerenderStatic } from 'vite-plugin-prerender-static';","symbol":"prerenderStatic","correct":"import prerenderStatic from 'vite-plugin-prerender-static';"},{"note":"generateSEOTags is from the separate 'prerender-core' package, not this plugin.","wrong":"import { generateSEOTags } from 'vite-plugin-prerender-static';","symbol":"generateSEOTags","correct":"import { generateSEOTags } from 'prerender-core';"},{"note":"Standard Vite export, not from the plugin.","wrong":"","symbol":"defineConfig","correct":"import { defineConfig } from 'vite';"}],"quickstart":{"code":"import { defineConfig } from 'vite';\nimport prerenderStatic from 'vite-plugin-prerender-static';\n\nexport default defineConfig({\n  plugins: [\n    prerenderStatic({\n      routes: [\n        {\n          path: '/',\n          tags: {\n            title: 'Home',\n            description: 'Welcome to my site',\n          },\n        },\n        {\n          path: '/about',\n          tags: {\n            title: 'About',\n            description: 'About us page',\n          },\n        },\n      ],\n      render: (route) => {\n        return `<div id=\"root\">Static content for ${route.path}</div>`;\n      },\n    }),\n  ],\n});\n","lang":"typescript","description":"Configures the plugin with two routes and a custom render function in a Vite config file."},"warnings":[{"fix":"Upgrade Vite to ^4 || ^5 || ^6 || ^7.","message":"Requires Vite v4 or higher. Older versions are unsupported.","severity":"breaking","affected_versions":"<0.1.0"},{"fix":"Use object format: tags: { title: '...' }","message":"The 'tags' option can be a string or object. String format is deprecated in favor of object format.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Delete or rename any existing template.html if you want auto-generation.","message":"If no 'template.html' exists, the plugin auto-generates one. Ensure your project root does not have a conflicting file.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use Vite's build command, not dev server.","message":"The plugin only runs during build. It does not work in dev mode.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Always provide a custom render function that generates the HTML for each route.","message":"Using 'render' function is optional; if omitted, a fallback is used. This fallback may not include your actual app content.","severity":"deprecated","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Change to import prerenderStatic from 'vite-plugin-prerender-static';","cause":"Using named import '{ prerenderStatic }' instead of default import.","error":"ERR_IMPORT_DEFAULT: Cannot import default export from non-module"},{"fix":"Ensure template.html exists or set the template option to an existing file.","cause":"Missing template.html in project root when template option not set.","error":"[vite] Internal server error: Cannot find module 'template.html'"},{"fix":"Ensure each route object has a 'path' string.","cause":"Routes array has an entry without a 'path' property.","error":"TypeError: route.path is undefined"},{"fix":"Add leading slash, e.g., 'about' -> '/about'.","cause":"Path does not start with a forward slash.","error":"Error: Route path must start with '/'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}