npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vite-plugin-prerender-static

v0.1.3

Published

Static prerendering plugin for Vite with SEO, meta tags, and multi-route support.

Readme

vite-plugin-prerender-static

Dead-simple static prerendering for Vite, implemented correctly.

A lightweight static prerendering solution for Vite with built-in SEO meta tag support, multi-route generation, and zero runtime dependencies. It generates fully static HTML pages from your SPA at build time, making it ideal for SEO-focused Vite applications without the complexity of SSR.


Features

  • Vite-native plugin (runs during build)
  • Static prerendering for multiple routes
  • SEO meta tag generation (Open Graph, Twitter, JSON-LD)
  • Framework-agnostic core
  • Correct handling of nested routes
  • Drop-in replacement with no breaking changes
  • Compatible with React, Vue, Svelte, Solid, and Vanilla JS

Installation

npm install vite-plugin-prerender-static

or

pnpm add vite-plugin-prerender-static

Usage

vite.config.ts

import { defineConfig } from "vite";
import prerenderStatic from "vite-plugin-prerender-static";

export default defineConfig({
  plugins: [
    prerenderStatic({
      routes: [
        {
          path: "/",
          tags: {
            title: "Home",
            description: "Welcome to my site",
          },
        },
        {
          path: "/about",
          tags: {
            title: "About",
            description: "About us page",
          },
        },
      ],

      render: (route) => {
        return `<div id="root">Static content for ${route.path}</div>`;
      },
    }),
  ],
});

SEO Configuration

Using Structured SEO Tags

{
  path: "/blog",
  tags: {
    title: "Blog",
    description: "Latest posts",
    author: "Rahul Sharma",
    url: "https://example.com/blog",
    image: "https://example.com/og.png",
    keywords: "vite, seo, prerender",
    canonical: "https://example.com/blog",
    robots: "index, follow",
    schema: {
      "@context": "https://schema.org",
      "@type": "Blog"
    }
  }
}

Template System

By default, the plugin looks for template.html in the project root.

Default Template (Auto-generated)

<!DOCTYPE html>
<html lang="en">
  <head>
    %LINKS%
    <title>%TITLE%</title>
  </head>
  <body>
    <div id="root">%APP%</div>
  </body>
</html>

Placeholders

| Placeholder | Description | | ----------- | ---------------------------------- | | %LINKS% | Injected scripts, styles, SEO tags | | %TITLE% | Page title | | %APP% | Rendered HTML content |


Default Behavior

  • If template.html is missing, it is automatically created
  • If render() is not provided, a fallback HTML output is used
  • Relative asset paths are fixed automatically
  • The plugin runs only during the Vite build phase

Options

prerenderStatic({
  routes: {
    path: string
    tags: string | SEOTagOptions
  }[],

  render?: (route) => string,
  template?: string,
  dist?: string
})

Core Package

This plugin is built on a framework-agnostic core:

import { generateSEOTags } from "prerender-core";

The core package can be used independently in:

  • Node.js scripts
  • Custom static site generators
  • Other build pipelines

Compatibility

| Tool | Supported Versions | | ---------- | ------------------------- | | Vite | v4 → v7 | | Node.js | v18+ | | Frameworks | React, Vue, Svelte, Solid |


When Should I Use This?

This plugin is a good fit if:

  • You need SEO support for SPAs
  • You want to avoid SSR complexity
  • You are deploying to static hosting
  • You want full control over the generated HTML

Author

Rahul Sharma Email: [email protected] GitHub: https://github.com/rahulsushilsharma


License

MIT © Rahul Sharma


Roadmap

  • CLI prerender tool
  • Automatic route discovery
  • HTML transformation hooks

Contributing

Pull requests are welcome. Please open an issue before proposing major changes.