Registry / devops / ignore-emit-webpack-plugin

ignore-emit-webpack-plugin

JSON →
library2.0.6jsnpmunverified

The `ignore-emit-webpack-plugin` is a Webpack plugin designed to prevent specific assets from being emitted to the output directory during the build process. Unlike other methods that might merely filter assets during compilation, this plugin explicitly operates on the final output path, providing precise control over what actually gets written to disk. Currently at version 2.0.6, the library demonstrates a moderate release cadence, addressing compatibility issues (e.g., with Webpack 4, Terser, SourceMapDevTools) and adding support for newer Webpack versions (e.g., Webpack 5). It differentiates itself by offering flexible pattern matching (RegExp, string, or arrays) against the *output* path of assets, and since v2.0.2, it is rewritten in TypeScript, offering improved type safety and maintainability for modern JavaScript ecosystems.

npm install ignore-emit-webpack-plugin
INSTALL
IMPORT
SIG · IGNORE-EMIT-WEBPAC
I
ignore-emit-webpack-plugin
devopsjavascriptv2.0.6
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.

IgnoreEmitPlugin
import IgnoreEmitPlugin from 'ignore-emit-webpack-plugin';
import { IgnoreEmitPlugin } from 'ignore-emit-webpack-plugin';
The plugin is a default export. Named imports like `{ IgnoreEmitPlugin }` are incorrect.
IgnoreEmitPlugin (CommonJS)
const IgnoreEmitPlugin = require('ignore-emit-webpack-plugin');
const { IgnoreEmitPlugin } = require('ignore-emit-webpack-plugin');
For CommonJS environments, `require` returns the default export directly. Named destructuring is incorrect.
IgnoreEmitPlugin (ES5 build)
const IgnoreEmitPlugin = require('ignore-emit-webpack-plugin/es5');
Use this specific path if your environment requires an ES5-transpiled version of the module, though the main export should work for most modern Node.js versions.

Demonstrates how to import and register the plugin in a Webpack configuration to prevent source map files and a specific license file from being emitted.

// webpack.config.js import IgnoreEmitPlugin from 'ignore-emit-webpack-plugin'; export default { mode: 'development', entry: './src/index.js', output: { filename: 'bundle.js', path: new URL('./dist', import.meta.url).pathname, }, plugins: [ // This will prevent any generated .map files from being emitted to the output directory. new IgnoreEmitPlugin(/\.map$/), // To prevent a specific asset, e.g., 'licenses.txt', after it's been generated by another plugin. // Note: The pattern matches against the output path, e.g., 'licenses.txt' for a file in the root of 'dist'. new IgnoreEmitPlugin('licenses.txt') ] };
Debug
Known issues
gotchaCareless use of patterns can lead to accidental deletion of critical output files. Always thoroughly test your patterns to ensure only intended assets are ignored.
fix
Start with specific patterns and gradually broaden them if necessary. Use `options.debug: true` to observe what files are being matched without actually preventing their emission first.
affects: >=1.0.0
breakingOlder versions of the plugin (prior to v2.0.4 and v2.0.5) may have limited or no compatibility with Webpack 5, or specific bugs when used with Webpack 4.
fix
Upgrade to the latest `ignore-emit-webpack-plugin` (v2.0.4+) to ensure full Webpack 5 support and critical bug fixes for Webpack 4.
affects: <2.0.4
gotchaThe plugin's patterns match against the *output path* of assets, not their source paths. Misunderstanding this can lead to patterns failing to match any assets.
fix
Inspect your Webpack build stats to confirm the exact output paths of the assets you intend to ignore, then adjust your regular expressions or string patterns accordingly.
affects: >=1.0.0
gotchaVersions prior to v2.0.6 had known compatibility issues with other Webpack plugins, specifically Terser and SourceMapDevTools, which could lead to unexpected build failures or incorrect output.
fix
Ensure you are using `ignore-emit-webpack-plugin` v2.0.6 or newer to resolve known compatibility problems with common Webpack plugins.
affects: <2.0.6
gotchaThe package was rewritten in TypeScript in v2.0.2. While CJS and ESM imports are supported, internal structures or behaviors might have subtly changed for users relying on undocumented internals from pre-v2.0.2 versions.
fix
If encountering issues after upgrading from a pre-v2.0.2 version, consult the README for correct import statements and ensure your patterns are valid.
affects: <2.0.2
Errors
Common errors & fixes
Error: Plugin initialization failed: patterns must be defined and valid.
The `IgnoreEmitPlugin` was instantiated without a `patterns` argument or with an invalid type for the argument.
fix
Provide a valid `RegExp`, `string`, or `Array<RegExp|string>` as the first argument to the plugin constructor, e.g., `new IgnoreEmitPlugin(/\.map$/)`.
Asset still emitted despite IgnoreEmitPlugin being configured.
The provided pattern does not correctly match the asset's final output path, or the pattern is being applied to the source path instead of the emitted asset's path.
fix
Verify the exact output path of the asset you wish to ignore by examining your Webpack build output or stats. Adjust your plugin pattern to precisely match this output path. Remember patterns like `^file.js` match the start of the path, while `/file.js` matches anywhere.
Upgrade
Version history
2.0.6latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources