Registry / devops / mini-html-webpack-plugin

mini-html-webpack-plugin

JSON →
library3.1.3jsnpmunverified

A lightweight alternative to html-webpack-plugin for webpack 4 and 5, automating CSS and JS asset path injection into HTML templates. Current stable version 3.1.3 (October 2020) with no active development since. Supports multi-page setups via chunks, custom template functions, and HTML minification. Unlike html-webpack-plugin, it does not support plugins for html-webpack-plugin, making it simpler but less extensible. Written in TypeScript with bundled type definitions.

npm install mini-html-webpack-plugin
INSTALL
IMPORT
SIG · MINI-HTML-WEBPACK-
M
mini-html-webpack-plugin
devopsjavascriptv3.1.3
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

MiniHtmlWebpackPlugin
const { MiniHtmlWebpackPlugin } = require('mini-html-webpack-plugin');
const MiniHtmlWebpackPlugin = require('mini-html-webpack-plugin');
CommonJS require extracts named export; default import was removed in v3.0.5.
generateAttributes
import { generateAttributes } from 'mini-html-webpack-plugin';
import generateAttributes from 'mini-html-webpack-plugin';
ESM named export, not default.
generateCSSReferences
import { generateCSSReferences } from 'mini-html-webpack-plugin';
const generateCSSReferences = require('mini-html-webpack-plugin').generateCSSReferences;
Same as above; both named exports.

Basic setup with MiniHtmlWebpackPlugin: define webpack configuration, add plugin, run compiler.

const { MiniHtmlWebpackPlugin } = require('mini-html-webpack-plugin'); const webpack = require('webpack'); const compiler = webpack({ entry: './index.js', output: { path: __dirname + '/dist', filename: 'bundle.js', }, plugins: [ new MiniHtmlWebpackPlugin({ context: { title: 'My App' }, chunks: ['main'] }), ], }); compiler.run((err, stats) => { if (err) console.error(err); console.log(stats.toString({ colors: true })); });
Debug
Known issues
breakingDrop default export to fix CommonJS (v3.0.5)
fix
Switch from default import/require to named export: const { MiniHtmlWebpackPlugin } = require(...)
affects: >=3.0.5
breakingWebpack 5 compatibility: emit hook change
fix
Upgrade to v3.1.0+ for webpack 5 support
affects: >=3.1.0
deprecatedNo updates since 2020; package is in maintenance mode
fix
Consider forking or switching to html-webpack-plugin if more features are needed
affects: all
gotchaDoes not work with html-webpack-plugin plugins (e.g., html-webpack-harddisk-plugin)
fix
Do not use those plugins; implement custom templates instead
affects: all
gotchaRequires Node >=10
fix
Use Node 10+
affects: all
Errors
Common errors & fixes
Cannot find module 'mini-html-webpack-plugin'
Package not installed
fix
npm install mini-html-webpack-plugin
MiniHtmlWebpackPlugin is not a constructor
Using default require instead of named export
fix
Use const { MiniHtmlWebpackPlugin } = require('mini-html-webpack-plugin');
TypeError: MiniHtmlWebpackPlugin is not a constructor
Using default import in ESM context
fix
Use import { MiniHtmlWebpackPlugin } from 'mini-html-webpack-plugin';
Error: Hook not found: emit
Using webpack 5 with plugin version <3.1.0
fix
Update to mini-html-webpack-plugin >=3.1.0
Upgrade
Version history
3.1.3latest on npm
Audit
Dependencies
webpackoptionalpeer dependency, >=4
Agent activity
2 hits · last 30 days
node
2
Resources
mini-html-webpack-plugin — npm install mini-html-webpack-plugin · libregistry