babel-plugin-add-filehash
raw JSON → 7.6.0 verified Sat Apr 25 auth: no javascript maintenance
A Babel plugin that forces output to change whenever the input file changes, even for trivial/whitespace changes. Version 7.6.0 is current, but the primary use case (forcing Webpack to show updated eslint messages on unchanged files) has been obsolete since Webpack v3.5.4 fixed the underlying issue. The plugin remains functional for anyone needing deterministic output changes, but it is effectively a legacy tool. It has no dependencies beyond Babel itself and is a zero-config plugin.
Common errors
error Error: [BABEL] unknown: The filehash plugin hasn't generated any changes. (While processing: /path/to/file.js) ↓
cause Plugin may not add hash if file already contains output hash or if configuration conflicts.
fix
Verify plugin is correctly listed in plugins array. Check for other plugins that may suppress output.
Warnings
deprecated Plugin is unnecessary for modern Webpack (>=3.5.4). Original use case fixed. ↓
fix Remove plugin from configuration if using Webpack v3.5.4+.
Install
npm install babel-plugin-add-filehash yarn add babel-plugin-add-filehash pnpm add babel-plugin-add-filehash Imports
- plugin (default) wrong
import addFilehash from 'babel-plugin-add-filehash'correctmodule.exports = { plugins: ['add-filehash'] }
Quickstart
// .babelrc or babel.config.js
{
"plugins": [
["add-filehash", {
// Optional: specify which comment to add hash to
// Default: adds hash as file comment
}]
]
}