Registry / devops / webpack-exclude-assets-plugin

webpack-exclude-assets-plugin

JSON →
library0.1.1jsnpmunverified

Webpack 4 plugin to exclude assets from the output bundle based on a path RegExp pattern. Version 0.1.1 is the latest stable release with no further updates since 2018. It is designed to remove unwanted JS files generated alongside extracted CSS/Stylus files when using extract plugins like mini-css-extract-plugin. Lightweight alternative to manual asset filtering in webpack configuration, but only compatible with webpack 4 and does not support webpack 5. Ideal for projects that use style entry points and want to eliminate empty JS output files. Last published 6 years ago; no active maintenance.

npm install webpack-exclude-assets-plugin
INSTALL
IMPORT
SIG · WEBPACK-EXCLUDE-AS
W
webpack-exclude-assets-plugin
devopsjavascriptv0.1.1
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.

ExcludeAssetsPlugin
const ExcludeAssetsPlugin = require('webpack-exclude-assets-plugin');
import ExcludeAssetsPlugin from 'webpack-exclude-assets-plugin';
CommonJS is the only supported module system; ESM import may fail depending on bundler config.
ExcludeAssetsPlugin
import ExcludeAssetsPlugin = require('webpack-exclude-assets-plugin');
const { ExcludeAssetsPlugin } = require('webpack-exclude-assets-plugin');
The default export is the constructor; named destructuring will not work.
ExcludeAssetsPlugin
const ExcludeAssetsPlugin = require('webpack-exclude-assets-plugin').default;
const ExcludeAssetsPlugin = require('webpack-exclude-assets-plugin');
The package has both a CommonJS default and a named export 'default'; require returns an object with 'default' as the plugin constructor in some environments. Use .default to be safe.

Configures webpack 4 to exclude empty JS files generated from CSS entries using regex pattern.

const path = require('path'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const ExcludeAssetsPlugin = require('webpack-exclude-assets-plugin').default; module.exports = { entry: { app: path.resolve(__dirname, 'js/app.js'), 'css/app': path.resolve(__dirname, 'css/app.css') }, output: { path: path.join(__dirname, 'dist'), filename: 'js/[name].js' }, plugins: [ new MiniCssExtractPlugin({ filename: '[name].css' }), new ExcludeAssetsPlugin({ path: ['^js\\/css\\.*\\.js$'] }) ], module: { rules: [ { test: /\.css$/, exclude: /node_modules/, use: [MiniCssExtractPlugin.loader, 'css-loader'] } ] }, resolve: { extensions: ['.css'] } };
Debug
Known issues
breakingPlugin does not work with webpack 5. It relies on internal webpack 4 hooks (compilation.hooks.optimizeAssets) that are removed in webpack 5.
fix
Use webpack 4 or find an alternative such as 'webpack-files-archive-plugin' or custom plugin for webpack 5.
affects: >=0.1.1
gotchaThe `path` option expects regex strings, not actual RegExp objects. The plugin throws if you pass a RegExp literal.
fix
Pass a string or array of strings representing the regex pattern. Example: path: ['^js\\/css\\.*\\.js$']
affects: >=0.1.0
gotchaThe plugin does not handle file extensions with dashes or dots correctly in some regex patterns due to missing escaping.
fix
Manually escape special regex characters in the path patterns (e.g., use '\\.' instead of '.').
affects: >=0.1.0
deprecatedPackage has not been updated since 2018 and is considered deprecated for new projects.
fix
Migrate to webpack 5 native asset filtering using 'webpack.IgnorePlugin' or 'output.clean' option.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'length')
The plugin expects the compilation.assets object to have named keys, but it may be empty or undefined if used asynchronously.
fix
Ensure that the plugin is added to the plugins array and that compilation is not deferred. Use synchronous loaders.
Error: ExcludeAssetsPlugin: path must be a string or an array of strings
Passed a RegExp object instead of a string pattern.
fix
Convert the RegExp to a string: path: ['^js\\/css\\.*\\.js$']
TypeError: excludeAssetsPlugin is not a constructor
Using named import incorrectly (e.g., const { ExcludeAssetsPlugin } = require(...)).
fix
Use default require: const ExcludeAssetsPlugin = require('webpack-exclude-assets-plugin').default;
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
12
OpenAI (training)
1
Resources
webpack-exclude-assets-plugin — npm install webpack-exclude-assets-plugin · libregistry