Registry / web-framework / rollup-plugin-generate-html

rollup-plugin-generate-html

JSON →
library0.2.0jsnpmunverified

Rollup plugin to generate an HTML file that includes the bundle script. Works with Rollup's output to insert script tags into a template, optionally inline the bundle. Version 0.2.0 targets Node >=8.3. Abandoned – last commit in 2019, no releases since. Simpler than rollup-plugin-html but lacks features like asset injection or multi-page support.

npm install rollup-plugin-generate-html
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-GENE
R
rollup-plugin-generate-html
web-frameworkjavascriptv0.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

generateHtml
✓ import generateHtml from 'rollup-plugin-generate-html'
✗ const generateHtml = require('rollup-plugin-generate-html')
Default export only; no named export. ESM only, no CJS wrapper.
generateHtml (as named)
✓ import { default as generateHtml } from 'rollup-plugin-generate-html'
✗ import { generateHtml } from 'rollup-plugin-generate-html'
Named import of default does not work; must use default import or alias.
default import with different name
✓ import genHtml from 'rollup-plugin-generate-html'
Any default import works; name not enforced.

Basic setup to generate an HTML file that includes the bundle script via Rollup.

// rollup.config.js import generateHtml from 'rollup-plugin-generate-html' export default { input: 'src/index.js', output: { file: 'dist/bundle.js', format: 'iife' }, plugins: [ generateHtml({ filename: 'dist/index.html' }) ] }
Debug
Known issues
gotchaThe plugin generates HTML after the bundle is written, requiring the output file to be present. Ensure output.file is set, not output.dir.
fix
Set output.file to a single file; plugin does not support code splitting or multiple outputs.
affects: >=0.0.0
gotchaThe inline option does not support code splitting; all chunks are inlined into a single script tag. May cause issues with dynamic imports.
fix
Avoid inline with dynamic imports or use with simple IIFE bundles.
affects: >=0.0.0
gotchaThe template option expects a path to a file relative to the current working directory, not relative to the config file. Absolute paths recommended.
fix
Use path.resolve(__dirname, 'template.html') for robust path resolution.
affects: >=0.1.0
deprecatedThe plugin is effectively abandoned; no updates since 2019. May not work with Rollup >=2.x (uses deprecated plugin API).
fix
Consider alternatives like @rollup/plugin-html or rollup-plugin-html2.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Could not resolve 'template' option
Template file path is incorrect or file does not exist.
fix
Ensure the template path is correct and accessible from the current working directory. Use an absolute path.
TypeError: generateHtml is not a function
Importing wrong symbol; plugin exports default only.
fix
Use import generateHtml from 'rollup-plugin-generate-html' (default import).
Cannot find module 'rollup-plugin-generate-html'
Package not installed or import path incorrect.
fix
Run npm install -D rollup-plugin-generate-html and ensure package.json includes it.
Error: Failed to generate HTML: output option must be a single file
Plugin requires output.file to be set, not output.dir.
fix
Set output.file to a single bundle file; this plugin does not support code splitting.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies
rolluprequiredpeer dependency for Rollup plugin interface
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-generate-html — npm install rollup-plugin-generate-html · libregistry