Registry / devops / emit-changed-only-webpack-plugin

emit-changed-only-webpack-plugin

JSON →
library2.1.4jsnpmunverified

Webpack production plugin that prevents identical output files from being re-emitted after a rebuild, preserving cache headers (ETag, Last-Modified) for unchanged assets. Current stable version 2.1.4 requires webpack ^4.0.0. Key differentiator: focuses on file emission behavior rather than chunk-level comparison, using [contenthash] to detect changes. Helps improve browser caching and V8 code caching by avoiding unnecessary file modifications. Ships TypeScript types.

npm install emit-changed-only-webpack-plugin
INSTALL
IMPORT
SIG · EMIT-CHANGED-ONLY-
E
emit-changed-only-webpack-plugin
devopsjavascriptv2.1.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.

EmitChangedOnlyPlugin
const EmitChangedOnlyPlugin = require('emit-changed-only-webpack-plugin')
import EmitChangedOnlyPlugin from 'emit-changed-only-webpack-plugin'
Package is CommonJS only. ES module import will fail. If TypeScript, use `import EmitChangedOnlyPlugin = require(...)` or set `esModuleInterop`.
default
import EmitChangedOnlyPlugin from 'emit-changed-only-webpack-plugin'
import { EmitChangedOnlyPlugin } from 'emit-changed-only-webpack-plugin'
Default export only. Named import does not exist.
EmitChangedOnlyPlugin
new EmitChangedOnlyPlugin({ exclude: /\.html$/i })
new EmitChangedOnlyPlugin()
Always pass at least an options object; omitting may cause unexpected behavior with default options (e.g., production mode required).

Minimal webpack configuration using the plugin with contenthash filenames and an HTML exclusion pattern.

const EmitChangedOnlyPlugin = require('emit-changed-only-webpack-plugin'); module.exports = { output: { path: './dist', filename: '[name].[contenthash].js' }, plugins: [ new EmitChangedOnlyPlugin({ exclude: /\.html$/i }) ] };
Debug
Known issues
gotchaPlugin requires [contenthash] in output filename; without it, file comparison is unreliable and plugin may emit all files every build.
fix
Add [contenthash] to output.filename, e.g., '[name].[contenthash].js'.
affects: >=1.0.0
gotchaProduction mode is enforced by default. If mode is not 'production', plugin will skip logic and may not behave as expected.
fix
Set mode: 'production' in webpack config, or pass production: false in plugin options.
affects: >=2.0.0
gotchaThe plugin removes outdated files in the output directory. Any files that are not produced by webpack and not excluded may be deleted.
fix
Add patterns to exclude option to protect non-plugin files, e.g., exclude: /\.(txt|png)$/i.
affects: >=1.0.0
gotchaUsing splitChunks: false will disable chunk splitting optimization; only the entry chunk is emitted. Default is true.
fix
If you want chunk splitting, keep splitChunks: true (default). Set to false only if you know you don't need it.
affects: >=2.0.0
Errors
Common errors & fixes
TypeError: plugin is not a constructor
Importing as ES module named import or using wrong require path.
fix
Use const EmitChangedOnlyPlugin = require('emit-changed-only-webpack-plugin');
Cannot find module 'emit-changed-only-webpack-plugin'
Package not installed or misspelled npm package name.
fix
npm install emit-changed-only-webpack-plugin --save-dev
Error: Webpack mode must be 'production'
Plugin enforces production mode by default.
fix
Set mode: 'production' or pass production: false in plugin options.
Error: No output filename with [contenthash] found
Output filename does not contain [contenthash].
fix
Add [contenthash] to output.filename, e.g., '[name].[contenthash].js'.
Upgrade
Version history
2.1.4latest on npm
Audit
Dependencies
webpackrequiredPeer dependency; plugin integrates with webpack's compiler hooks
Agent activity
4 hits · last 30 days
node
4
Resources
emit-changed-only-webpack-plugin — npm install emit-changed-only-webpack-plugin · libregistry