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
muslnode 18–223 runs
build_error
glibcnode 18–223 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>
Errors
Common errors & fixes
Error: [vite-html-plugin] The 'template' option is required
Missing template option in configureHtml()
fixAdd template: 'path/to/template.html' to configureHtml() options
TypeError: Cannot read properties of undefined (reading 'ejs')
Accessing options.inject without providing inject object
fixProvide inject object: inject: { data: {}, ejs: true } Module not found: Error: Can't resolve 'vite-html-plugin'
Package not installed or using wrong import path
fixInstall: npm install vite-html-plugin@0.1.4
Audit
Dependencies
viterequiredpeer dependency; plugin requires Vite as build tool
ejsoptionalused for template rendering