{"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,"search_vec":"'1':45 '2':46 '2017':11 '3':48 '4':50,55 'affect':77 'allow':31 'asset':62 'basi':22 'built':60 'built-in':59 'chunk':2,21,25,72,85 'chunk-rename-webpack-plugin':1 'config':80 'consid':56 'custom':28 'differenti':67 'explicit':69 'file':33 'filenam':29,75 'global':78 'hash':41,86 'includ':40 'javascript':81 'last':9 'maintain':52 'map':24,70 'modul':63 'name':26,37,73 'node':49 'other':39 'output':79 'output.chunkfilename':16 'output.filename':14 'overrid':13 'per':20 'per-chunk':19 'plugin':5,7,66,83 'releas':10 'renam':3,84 'simpl':68 'static':36 'templat':30 'v1.1.1':8 'webpack':4,6,44,54,57,82 'without':76 'work':42","created_at":"2026-04-25T11:17:37.647085+00:00","updated_at":"2026-04-25T11:17:37.647085+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/sueddeutsche/chunk-rename-webpack-plugin","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/chunk-rename-webpack-plugin","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}