A webpack plugin that works with html-webpack-plugin (>=3.0.0) to skip adding certain output files (chunks, assets) to the generated HTML. Current version 1.0.4, maintained, compatible with webpack 3–5. Acts as a drop-in replacement for the unmaintained html-webpack-exclude-assets-plugin. Supports glob patterns (minimatch), regex, or callback functions to filter assets. Allows configuration on either HtmlWebpackPlugin options or plugin constructor. Fixes CVEs and global regex issues in prior versions.
npm install html-webpack-skip-assets-pluginVerified import paths — ran on the pinned version, not inferred.
Shows minimal webpack config with HtmlWebpackSkipAssetsPlugin to exclude polyfill and style JS files from the HTML output.
Upgrade webpack to >=3 and html-webpack-plugin to >=3.
Always list HtmlWebpackPlugin first, then HtmlWebpackSkipAssetsPlugin.
Replace excludeAssets with skipAssets in plugin configuration.
Use minimatch glob syntax (e.g., 'polyfill.**.js' not 'polyfill.*.js').
Access asset.tagName and asset.attributes, not the filename directly.
Update to version 1.0.2 or later.
Use destructured import: const { HtmlWebpackSkipAssetsPlugin } = require(...);Place HtmlWebpackSkipAssetsPlugin after HtmlWebpackPlugin in the plugins array.