A webpack plugin that replaces references to static files (CSS, JS, images, SVG sprites) in HTML templates and source files with their contenthash-based filenames. Current stable version is 1.0.17 (last updated August 2017). It requires the loader-utils package and works with webpack 3.x and older. Unlike webpack's built-in [contenthash] support, this plugin directly modifies text files (not just output filenames) and is useful for projects that need to update hardcoded paths in templates or source code. It is considered legacy; modern webpack versions (4+) have native similar functionality.
npm install replacer-contenthash-webpack-pluginVerified import paths — ran on the pinned version, not inferred.
Basic webpack config showing plugin instantiation with filesDir and templatesFolder options.
Use webpack's built-in [contenthash] or a maintained alternative like gulp-rev.
Run: npm install loader-utils --save-dev
Only run plugin on copies of files or ensure you can revert changes.
Pass a single string with comma-separated paths for each property.
Migrate to a modern alternative like webpack-subresource-integrity or html-webpack-plugin with hash.
npm install loader-utils --save-dev
Use: const ReplacerContenthashWebpackPlugin = require('replacer-contenthash-webpack-plugin');Ensure at least one of filesDir or files is provided, and one of templatesFolder or templates.
Use webpack 3.x or switch to a modern plugin.