{"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,"search_vec":"'0.1.3':19 '18':25 '4':22 '7':23 'activ':83 'agnost':47 'automat':97 'avoid':63 'build':78 'built':31 'built-in':30 'cli':95 'complex':65 'depend':56 'differenti':59 'discoveri':99 'drop':70 'drop-in':69 'etc':51 'featur':93 'framework':46 'framework-agnost':45 'futur':92 'generat':36,74 'graph':38 'html':76 'improv':16 'javascript':100 'json':41 'json-ld':40 'key':58 'ld':42 'lightweight':7 'like':94 'maintain':84 'meta':34,113 'meta-tag':112 'multipl':27 'node':24 'open':37 'plugin':3,9,81,104 'prerend':4,12,105 'provid':67 'react':48 'recent':86 'replac':72 'requir':53 'roadmap':90 'rout':28,98 'runtim':55 'seo':17,33,109 'simplic':61 'site':108 'spa':111 'spas':14 'ssg':110 'ssr':64 'static':5,11,75,107 'static-sit':106 'support':20 'svelt':50 'tag':35,114 'time':79 'twitter':39 'typescript':115 'updat':87 'version':18 'vite':2,8,21,101,103 'vite-plugin':102 'vite-plugin-prerender-stat':1 'vue':49 'zero':54","created_at":"2026-04-27T17:06:59.891174+00:00","updated_at":"2026-04-27T17:06:59.891174+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/rahulsushilsharma/vite-plugin-prerender-static","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/vite-plugin-prerender-static","openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}