Registry / devops / webpack-chunk-hash

webpack-chunk-hash

JSON →
library0.6.0jsnpmunverified

Webpack plugin that replaces standard chunk hashing with a custom MD5 hash, without sorting chunks (unobtrusive) and using Node's native crypto module for performance. Current stable version is 0.6.0, which supports Webpack 4 while maintaining backward compatibility with Webpack 3. It is a clone of webpack-md5-hash but avoids chunk sorting and uses native crypto. The plugin offers options for algorithm, digest, and additional hash content. Release cadence is low; the plugin is stable but not actively developed.

npm install webpack-chunk-hash
INSTALL
IMPORT
SIG · WEBPACK-CHUNK-HASH
W
webpack-chunk-hash
devopsjavascriptv0.6.0
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.

WebpackChunkHash
const WebpackChunkHash = require('webpack-chunk-hash');
import WebpackChunkHash from 'webpack-chunk-hash';
This package is CommonJS-only and does not provide an ESM export. Use require() or use a default import with a bundler that handles CJS interop.
WebpackChunkHash
import WebpackChunkHash from 'webpack-chunk-hash';
With bundlers like Webpack or esbuild that support CJS interop, a default import works. However, the package exports via module.exports, so named imports will fail.
WebpackChunkHash
new WebpackChunkHash({ algorithm: 'md5' })
new WebpackChunkHash.WebpackChunkHash({ algorithm: 'md5' })
The plugin is a constructor. Do not try to access a property on it; just instantiate directly.

Replaces Webpack's default chunk hashing with MD5 using the plugin. Configures output filenames with [chunkhash] and applies the plugin.

// webpack.config.js const WebpackChunkHash = require('webpack-chunk-hash'); module.exports = { entry: './src/index.js', output: { filename: '[name].[chunkhash].js', chunkFilename: '[name].[chunkhash].js', }, plugins: [ new WebpackChunkHash({ algorithm: 'md5', digest: 'hex' }) ] };
Debug
Known issues
deprecatedWebpack 4 integrated improved hashing natively; this plugin may be unnecessary.
fix
Consider removing the plugin and relying on Webpack 4's built-in hashing or upgrading to Webpack 5 which uses content hash.
affects: >=0.6.0
breakingWebpack 5 dropped support for [chunkhash] in favor of [contenthash]; this plugin may not work with Webpack 5.
fix
Use [contenthash] instead of [chunkhash] and replace this plugin with Webpack 5's built-in deterministic hashing.
affects: >=0.6.0
gotchaThe plugin does not sort chunks before hashing; this can lead to inconsistent hashes across builds if chunk order varies.
fix
Ensure chunk order is deterministic or use a plugin that sorts chunks (e.g., webpack-md5-hash).
affects: >=0.0.0
gotchaOnly CommonJS require is supported; ESM imports may fail if the bundler does not handle CJS interop.
fix
Use require() or configure your bundler for CJS interop.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: WebpackChunkHash is not a constructor
Using a named import (import { WebpackChunkHash }) when the package exports via module.exports.
fix
Use default import: const WebpackChunkHash = require('webpack-chunk-hash');
Cannot find module 'webpack-chunk-hash'
Package not installed or not in node_modules.
fix
Run: npm install --save-dev webpack-chunk-hash
Upgrade
Version history
0.6.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
webpack-chunk-hash — npm install webpack-chunk-hash · libregistry