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.

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.
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+.
npm install babel-plugin-add-filehash
yarn add babel-plugin-add-filehash
pnpm add babel-plugin-add-filehash

Shows how to enable the plugin in Babel configuration.

// .babelrc or babel.config.js
{
  "plugins": [
    ["add-filehash", {
      // Optional: specify which comment to add hash to
      // Default: adds hash as file comment
    }]
  ]
}