Registry / devops / webpack-chunk-rename-plugin

webpack-chunk-rename-plugin

JSON →
library1.0.3jsnpmunverified

A webpack plugin to rename chunks, supporting initial chunks with entry, async chunks, and specific chunk naming. Current stable version is 1.0.3 (last release: unknown, possibly unmaintained). Requires webpack 4.1+ and Node >=6.11.7. Differentiates from similar plugins by offering per-chunk renaming with placeholders like [name], [hash], [chunkhash]. Note: webpack 5 compatibility is not documented; may break.

npm install webpack-chunk-rename-plugin
INSTALL
IMPORT
SIG · WEBPACK-CHUNK-RENA
W
webpack-chunk-rename-plugin
devopsjavascriptv1.0.3
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.

ChunkRenamePlugin
const ChunkRenamePlugin = require('webpack-chunk-rename-plugin');
import ChunkRenamePlugin from 'webpack-chunk-rename-plugin';
Package does not export ES modules; use CommonJS require. No default export for ESM.
ChunkRenamePlugin
const ChunkRenamePlugin = require('webpack-chunk-rename-plugin').default;
Some similar webpack plugins use .default; this plugin directly exports the constructor, so .default is undefined and will cause 'ChunkRenamePlugin is not a constructor' error if used.
ChunkRenamePlugin
new ChunkRenamePlugin({ initialChunksWithEntry: true })
new ChunkRenamePlugin()
Constructor expects an object; calling with no arguments passes undefined, leading to runtime error when options are accessed. Always pass at least an empty object.

Shows basic usage: rename initial chunks using output.filename, async chunks with a template, and a specific chunk by name.

const ChunkRenamePlugin = require('webpack-chunk-rename-plugin'); module.exports = { output: { filename: '[name].js', chunkFilename: '[name].[chunkhash].js', }, entry: { main: './src/index.js', }, plugins: [ new ChunkRenamePlugin({ initialChunksWithEntry: true, asyncChunks: 'async/[name].[chunkhash].js', main: 'custom/[name].js', }), ], };
Debug
Known issues
breakingPlugin is only compatible with webpack 4. Use with webpack 5 may cause build failures or incorrect chunk naming.
fix
Consider webpack 5 alternatives such as webpack's built-in chunk naming or community plugins explicitly supporting webpack 5.
affects: >=1.0.0
breakingRequires Node >=6.11.7. Older Node versions cause runtime errors due to unsupported JS features.
fix
Upgrade Node to at least 6.11.7 or use a transpiler/polyfill.
affects: >=1.0.0
gotchaIf no options object is passed to constructor, plugin errors with 'Cannot read property 'initialChunksWithEntry' of undefined'.
fix
Always provide an options object: new ChunkRenamePlugin({}) or with proper keys.
affects: >=1.0.0
gotchaSetting 'initialChunksWithEntry: true' uses output.filename pattern for initial chunks; if output.filename is undefined or not set, chunks may be named 'undefined.js'.
fix
Ensure output.filename is defined in webpack config.
affects: >=1.0.0
gotchaPlaceholders like [name] in chunk names refer to the original chunk name (the entry key or split chunk name), not a custom alias. Misuse leads to unexpected filenames.
fix
Use the entry point key (e.g., 'main') as the chunk name property for per-chunk renaming.
affects: >=1.0.0
Errors
Common errors & fixes
ChunkRenamePlugin is not a constructor
Importing with ES module syntax (import) or using .default when the package exports via module.exports directly.
fix
Use const ChunkRenamePlugin = require('webpack-chunk-rename-plugin');
Cannot read property 'initialChunksWithEntry' of undefined
Calling new ChunkRenamePlugin() without an options object.
fix
Pass an options object: new ChunkRenamePlugin({ initialChunksWithEntry: true })
TypeError: Cannot destructure property 'async' of 'undefined' or 'null'
If 'asyncChunks' option is not a string, or if webpack emits chunks without the expected structure (e.g., webpack 5 changes).
fix
Ensure asyncChunks is a string with valid placeholders; avoid using in webpack 5.
Error: [object Object] is not a valid chunk name
Passing a non-string value (e.g., an object) as a chunk name property in options.
fix
Chunk name properties must be strings containing placeholders like '[name].js'.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
webpackrequiredpeer dependency; plugin requires webpack 4.1+ to hook into compilation process.
Agent activity
14 hits · last 30 days
node
12
Resources
webpack-chunk-rename-plugin — npm install webpack-chunk-rename-plugin · libregistry