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.
npm install vite-plugin-prerender-staticVerified import paths — ran on the pinned version, not inferred.
Configures the plugin with two routes and a custom render function in a Vite config file.
Upgrade Vite to ^4 || ^5 || ^6 || ^7.
Use object format: tags: { title: '...' }Delete or rename any existing template.html if you want auto-generation.
Use Vite's build command, not dev server.
Always provide a custom render function that generates the HTML for each route.
Change to import prerenderStatic from 'vite-plugin-prerender-static';
Ensure template.html exists or set the template option to an existing file.
Ensure each route object has a 'path' string.
Add leading slash, e.g., 'about' -> '/about'.