You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

vite-plugin-html-prerender

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-html-prerender

Vite.js plugin for pre-rendering html for SPAs.

0.2.0
latest
Source
npmnpm
Version published
Weekly downloads
61
17.31%
Maintainers
1
Weekly downloads
 
Created
Source

vite-plugin-html-prerender

Vite.js plugin for pre-rendering html for SPAs.

Install

npm i -D vite-plugin-html-prerender

Usage

Add htmlPrerender to your configuration (vite.config.js/vite.config.ts):

import { defineConfig } from "vite";
import { htmlPrerender } from "vite-plugin-html-prerender";
import path from "path";

export default defineConfig({
    plugins: [
        htmlPrerender({
            /**
             * Required: Output directory of `vite build`.
             */
            staticDir: path.join(__dirname, "dist"),
        
            /**
             * Required: List of routes to pre-render.
             */
            routes: ["/", "/about"],

            /**
             * Optional: Query selector to wait for. Defaults to `#root`.
             */
            selector: "main",

            /**
             * Optional: To minify html. Uses https://github.com/kangax/html-minifier.
             */
            minify: {
                collapseBooleanAttributes: true,
                collapseWhitespace: true,
                decodeEntities: true,
                keepClosingSlash: true,
                sortAttributes: true
            }
        })
    ]
});

Keywords

vite

FAQs

Package last updated on 28 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts