{"id":20807,"library":"webpack-plugin-hash-output","title":"webpack-plugin-hash-output","description":"A Webpack plugin that replaces chunkhash placeholders with an MD5 hash of the final file content, computed after all other plugins (like UglifyJsPlugin) have run. v3.2.1 requires Webpack >=4. Unlike other hash plugins that compute hashes earlier, this plugin ensures that any change in the build pipeline—including minification configuration—is reflected in the output hash, preventing cache conflicts. It supports sourcemaps partially and has known ordering requirements with plugins like HtmlWebpackPlugin. Maintained on GitHub, low release cadence (last release 2020).","status":"active","version":"3.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/scinos/webpack-plugin-hash-output","tags":["javascript","webpack","plugin","generate","asset","hash"],"install":[{"cmd":"npm install webpack-plugin-hash-output","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-plugin-hash-output","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-plugin-hash-output","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for plugin functionality","package":"webpack","optional":false}],"imports":[{"note":"Plugin does not ship ESM; use CommonJS require. A default import via Babel/TypeScript may work if configured, but direct require is safest.","wrong":"import HashOutput from 'webpack-plugin-hash-output';","symbol":"HashOutput","correct":"const HashOutput = require('webpack-plugin-hash-output');"},{"note":"The default export is the constructor. Named import will not work. Use default import or require.","wrong":"import { HashOutput } from 'webpack-plugin-hash-output';","symbol":"HashOutput","correct":"import HashOutput from 'webpack-plugin-hash-output';"},{"note":"The plugin only has a constructor; no public methods. Configuration is via options object (optional).","wrong":"new HashOutput().someMethod()","symbol":"HashOutput","correct":"new HashOutput({ validateOutput: true })"}],"quickstart":{"code":"const HashOutput = require('webpack-plugin-hash-output');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  output: {\n    filename: '[name].[chunkhash].js',\n  },\n  plugins: [\n    new HashOutput({ validateOutput: true }),\n    new HtmlWebpackPlugin(),\n  ],\n};","lang":"javascript","description":"Configures webpack to replace chunkhash with content-based MD5 hash, placed before HtmlWebpackPlugin."},"warnings":[{"fix":"Place new HashOutput() before any plugin that uses asset filenames, e.g., HtmlWebpackPlugin.","message":"Plugin must be listed before other plugins like HtmlWebpackPlugin to correctly update asset references. Incorrect order will cause stale hashes in HTML.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Avoid using devtool sourcemaps with this plugin if correct sourcemap filenames are critical.","message":"Sourcemaps are only partially supported. The sourcemap filename is not updated; only the reference inside the chunk is changed, and the sourcemap's 'file' field is updated. This can cause sourcemap lookup failures.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade to webpack >=4 or stay on v2 (which supports webpack 3).","message":"Version 3.0.0 dropped support for webpack <4. (Breaking change from v2 to v3).","severity":"breaking","affected_versions":"<3.0.0"},{"fix":"Remove { validateOutput: true } from options; the validation is now always on.","message":"The 'validateOutput' option is deprecated since v3.2.0 and may be removed in future releases.","severity":"deprecated","affected_versions":">=3.2.0"},{"fix":"Set output.filename to include [chunkhash] (e.g., '[name].[chunkhash].js').","message":"When using multiple entry points, all chunk filenames are hashed. Ensure output.filename uses [chunkhash] or [contenthash].","severity":"gotcha","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":"Run npm install webpack-plugin-hash-output --save-dev and ensure the path is correct in the webpack config.","cause":"Plugin not installed or not in node_modules.","error":"Module not found: Can't resolve 'webpack-plugin-hash-output'"},{"fix":"Use const HashOutput = require('webpack-plugin-hash-output'); (no destructuring).","cause":"Using named import instead of default import, or incorrect require.","error":"TypeError: HashOutput is not a constructor"},{"fix":"Check that options are valid: currently only optional 'validateOutput' (deprecated) exists.","cause":"Passing invalid options to the constructor (e.g., misspelled option).","error":"ValidationError: Invalid options object. Hash Output Plugin has been initialized using an options object that does not match the API schema."},{"fix":"Move new HashOutput() to the top of the plugins array.","cause":"Plugin detects other plugins registered before it that might interfere (e.g., HtmlWebpackPlugin).","error":"The plugin 'webpack-plugin-hash-output' may conflict with other plugins. Please ensure it is the first plugin in the 'emit' phase."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}