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-pluginVerified import paths — ran on the pinned version, not inferred.
Basic setup with MiniHtmlWebpackPlugin: define webpack configuration, add plugin, run compiler.
Switch from default import/require to named export: const { MiniHtmlWebpackPlugin } = require(...)Upgrade to v3.1.0+ for webpack 5 support
Consider forking or switching to html-webpack-plugin if more features are needed
Do not use those plugins; implement custom templates instead
Use Node 10+
npm install mini-html-webpack-plugin
Use const { MiniHtmlWebpackPlugin } = require('mini-html-webpack-plugin');Use import { MiniHtmlWebpackPlugin } from 'mini-html-webpack-plugin';Update to mini-html-webpack-plugin >=3.1.0