Registry / devops / html-webpack-skip-assets-plugin

html-webpack-skip-assets-plugin

JSON →
library1.0.4jsnpmunverified

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-plugin
INSTALL
IMPORT
SIG · HTML-WEBPACK-SKIP-
H
html-webpack-skip-assets-plugin
devopsjavascriptv1.0.4
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.

HtmlWebpackSkipAssetsPlugin
const { HtmlWebpackSkipAssetsPlugin } = require('html-webpack-skip-assets-plugin');
const HtmlWebpackSkipAssetsPlugin = require('html-webpack-skip-assets-plugin');
The plugin is a named export, not default. CommonJS requires destructuring.
HtmlWebpackSkipAssetsPlugin
import { HtmlWebpackSkipAssetsPlugin } from 'html-webpack-skip-assets-plugin';
ESM named import. No default export exists.
HtmlWebpackSkipAssetsPlugin
new HtmlWebpackSkipAssetsPlugin({ skipAssets: ['polyfill.*.js'] })
Plugin must be instantiated after HtmlWebpackPlugin in the plugins array.

Shows minimal webpack config with HtmlWebpackSkipAssetsPlugin to exclude polyfill and style JS files from the HTML output.

const HtmlWebpackPlugin = require('html-webpack-plugin'); const { HtmlWebpackSkipAssetsPlugin } = require('html-webpack-skip-assets-plugin'); module.exports = { entry: './src/index.js', output: { path: './dist', filename: '[name].[contenthash].js' }, plugins: [ new HtmlWebpackPlugin({ template: './src/index.html' }), new HtmlWebpackSkipAssetsPlugin({ skipAssets: ['polyfill.*.js', /styles\..*\.js$/i] }) ] };
Debug
Known issues
breakingIn v1.0.0, support for webpack <3 and html-webpack-plugin <3 was dropped.
fix
Upgrade webpack to >=3 and html-webpack-plugin to >=3.
affects: >=1.0.0
gotchaThe plugin must be added AFTER HtmlWebpackPlugin in the plugins array. Order matters.
fix
Always list HtmlWebpackPlugin first, then HtmlWebpackSkipAssetsPlugin.
affects: >=0.0.1
deprecatedUsing the excludeAssets option is deprecated in favor of skipAssets but still supported for migration.
fix
Replace excludeAssets with skipAssets in plugin configuration.
affects: >=0.0.1
gotchaGlob patterns use minimatch, not webpack's test pattern syntax. Double-check patterns.
fix
Use minimatch glob syntax (e.g., 'polyfill.**.js' not 'polyfill.*.js').
affects: >=0.0.1
gotchaCallback functions receive an HtmlTagObject from html-webpack-plugin, not the asset filename string.
fix
Access asset.tagName and asset.attributes, not the filename directly.
affects: >=1.0.1
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'src')
Meta assets with null/undefined src or href attributes cause errors in earlier versions.
fix
Update to version 1.0.2 or later.
Uncaught Error: HtmlWebpackSkipAssetsPlugin is not a constructor
Importing the module incorrectly (assuming default export).
fix
Use destructured import: const { HtmlWebpackSkipAssetsPlugin } = require(...);
ERROR in HtmlWebpackSkipAssetsPlugin: Plugin must be used after HtmlWebpackPlugin
Plugin order in the plugins array is incorrect.
fix
Place HtmlWebpackSkipAssetsPlugin after HtmlWebpackPlugin in the plugins array.
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies
html-webpack-pluginrequiredpeer dependency - hooks into its lifecycle to filter assets
webpackrequiredpeer dependency - operates as a webpack plugin
Agent activity
4 hits · last 30 days
node
4
Resources
html-webpack-skip-assets-plugin — npm install html-webpack-skip-assets-plugin · libregistry