{"id":19404,"library":"chunk-rename-webpack-plugin","title":"chunk-rename-webpack-plugin","description":"Webpack plugin (v1.1.1, last released 2017) that overrides output.filename and output.chunkFilename on a per-chunk basis. It maps chunk names to custom filename templates, allowing some files to have static names while others include hashes. Works with webpack 1, 2, and 3 (Node 4+). Not maintained for webpack 4+ — consider webpack's built-in asset module or other plugins. Differentiator: simple, explicit mapping of chunk names to filenames without affecting global output config.","status":"deprecated","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/sueddeutsche/chunk-rename-webpack-plugin","tags":["javascript","webpack","plugin","rename","chunk","hashing"],"install":[{"cmd":"npm install chunk-rename-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add chunk-rename-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add chunk-rename-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin works with webpack 1, 2, and 3 only","package":"webpack","optional":false}],"imports":[{"note":"Package uses CommonJS, no default export. Use require().","wrong":"import ChunkRenamePlugin from 'chunk-rename-webpack-plugin';","symbol":"default","correct":"const ChunkRenamePlugin = require('chunk-rename-webpack-plugin');"},{"note":"Named import works but unnecessary; the package exports a single constructor.","wrong":"","symbol":"ChunkRenamePlugin","correct":"const { ChunkRenamePlugin } = require('chunk-rename-webpack-plugin');"},{"note":"Argument is a plain object mapping chunk names to filename templates, not regex or string.","wrong":"new ChunkRenamePlugin({ pattern: /.../ })","symbol":"Plugin usage","correct":"new ChunkRenamePlugin({ chunkName: 'filename.js' })"}],"quickstart":{"code":"const path = require('path');\nconst ChunkRenamePlugin = require('chunk-rename-webpack-plugin');\n\nmodule.exports = {\n  entry: {\n    init: './src/init.js',\n    vendor: './src/vendor.js',\n  },\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: '[name]-[chunkhash].js',\n    chunkFilename: 'chunk-[name]-[chunkhash].js',\n  },\n  plugins: [\n    new ChunkRenamePlugin({\n      init: 'init.js',\n      login: 'chunk-[name]-page.js',\n    }),\n  ],\n};","lang":"javascript","description":"Shows how to override global filename patterns for specific chunks using the plugin."},"warnings":[{"fix":"Migrate to webpack's built-in output.filename function or asset module rules.","message":"Package not updated since 2017; incompatible with webpack 4 and 5.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Verify chunk name spelling in webpack output (e.g., 'login' not 'Login').","message":"Chunk names must exactly match entry keys or async chunk names; case-sensitive.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use compatible webpack version or find alternative for newer webpack.","message":"Only works with webpack 1, 2, 3; requires Node >= 4.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use webpack 4/5 native hashing in output.filename function.","message":"Removes the ability to use [contenthash] or [fullhash] placeholders from webpack 4/5.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Replace 'import ChunkRenamePlugin from ...' with 'const ChunkRenamePlugin = require(...)'","cause":"Using import statement (ESM) with a CommonJS-only package.","error":"Error: ChunkRenamePlugin is not a constructor"},{"fix":"Run 'npm install chunk-rename-webpack-plugin --save-dev' or downgrade webpack to 1-3.","cause":"Package not installed or wrong webpack version (4/5).","error":"Module not found: Error: Can't resolve 'chunk-rename-webpack-plugin'"},{"fix":"Use webpack 1-3 or a compatible plugin like 'webpack-files-archive-plugin'.","cause":"Using plugin with webpack 4+ (API mismatch).","error":"Unhandled rejection: TypeError: Cannot read property 'getModules' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}