Registry / web-framework / vite-html-plugin

vite-html-plugin

JSON →
library0.1.4jsnpmunverified

A Vite plugin for processing HTML templates with EJS-like syntax, similar to html-webpack-plugin. Current stable version is 0.1.4 (last commit 2022). Provides a configureHtml() function to inject JS/CSS into HTML and supports EJS interpolation. Vite-native alternative to html-webpack-plugin with minimal configuration. Active development but limited documentation and test coverage.

npm install vite-html-plugin
INSTALL
IMPORT
SIG · VITE-HTML-PLUGIN
V
vite-html-plugin
web-frameworkjavascriptv0.1.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

configureHtml
import { configureHtml } from 'vite-html-plugin'
const { configureHtml } = require('vite-html-plugin')
ESM-only; does not support CommonJS require()
default
import viteHtmlPlugin from 'vite-html-plugin'
import { default as viteHtmlPlugin } from 'vite-html-plugin'
Default export is an object with configureHtml; named export preferred
type Plugin
import { type Plugin } from 'vite'
import { Plugin } from 'vite-html-plugin'
Plugin type is from Vite, not this package

Shows basic usage: configureHtml plugin with EJS template, script entry injection, and custom data.

// vite.config.ts import { defineConfig } from 'vite'; import { configureHtml } from 'vite-html-plugin'; export default defineConfig({ plugins: [ configureHtml({ entry: '/src/main.ts', // script entry template: 'index.html', // HTML template inject: { data: { title: 'My App' }, ejs: true } }) ] }); // index.html (template) <!DOCTYPE html> <html> <head> <title><%= title %></title> </head> <body> <div id="app"></div> <!-- script injected by plugin --> </body> </html>
Debug
Known issues
breakingv1.0.0 (backup) is unstable; use v0.1.4 for production
fix
Pin version to 0.1.4: npm install vite-html-plugin@0.1.4
affects: =1.0.0
gotchaPlugin does not support HMR for HTML template changes; requires full reload
fix
No fix; use alternative plugin or full reload on template edits
affects: <=0.1.4
deprecatedoptions.inject.ejs is optional but defaults to false; set to true to enable EJS rendering
fix
Explicitly set inject: { ejs: true } in configureHtml() options
affects: >=0.1.0
Errors
Common errors & fixes
Error: [vite-html-plugin] The 'template' option is required
Missing template option in configureHtml()
fix
Add template: 'path/to/template.html' to configureHtml() options
TypeError: Cannot read properties of undefined (reading 'ejs')
Accessing options.inject without providing inject object
fix
Provide inject object: inject: { data: {}, ejs: true }
Module not found: Error: Can't resolve 'vite-html-plugin'
Package not installed or using wrong import path
fix
Install: npm install vite-html-plugin@0.1.4
Upgrade
Version history
0.1.4latest on npm
Audit
Dependencies
viterequiredpeer dependency; plugin requires Vite as build tool
ejsoptionalused for template rendering
Agent activity
2 hits · last 30 days
node
2
Resources
vite-html-plugin — npm install vite-html-plugin · libregistry