A Webpack plugin that minimizes HTML files using HTMLMinifier during the build process. Currently at version 2.2.3, it integrates directly into Webpack's plugin system, applying HTMLMinifier options to all HTML files processed by loaders such as html-loader. It supports custom HTMLMinifier configuration and works with Webpack 4+. Compared to alternatives like html-webpack-plugin's minification, this plugin is more lightweight and focused solely on minimization.
npm install html-minifier-webpack-pluginNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage with ESM import and HTMLMinifier minification options.
If using Webpack 5, prefer setting optimization.minimize in webpack config or use html-webpack-plugin with minification enabled.
Run 'npm install html-minifier --save-dev' to install peer dependency.
Use either this plugin or html-webpack-plugin's minification, not both.
npm install html-minifier --save-dev
Use default import: import HtmlMinifierPlugin from 'html-minifier-webpack-plugin'
Ensure html-minifier is in node_modules; install it via npm.