A flexible, framework-agnostic Vite plugin for prerendering static HTML from single-page applications. Version 1.0.8 supports any framework (Vue, React, etc.) and offers customizable configuration including route selection, post-processing, minification, and server options. It uses Puppeteer under the hood via the prerenderer library. Release cadence is irregular; the plugin is largely feature-complete with occasional bug fixes. Differentiators include full Vite compatibility, ease of use, and support for custom renderers.
npm install vite-plugin-prerenderVerified import paths — ran on the pinned version, not inferred.
Basic Vite configuration to prerender three routes into static HTML files.
Use vite build to generate prerendered output.
Upgrade to v1.0.8 or ensure postProcess always returns a renderedRoute object.
npm install puppeteer --save-dev
List all routes explicitly or generate them programmatically.
npm install puppeteer --save-dev
Change import from `import { vitePrerender } from 'vite-plugin-prerender'` to `import vitePrerender from 'vite-plugin-prerender'`Add staticDir: path.join(__dirname, 'dist') to the options object.
Provide an array of route strings in the options, e.g., routes: ['/', '/about'].