{"id":22051,"library":"rollup-plugin-hash","title":"rollup-plugin-hash","description":"Rollup plugin to append content hashes to bundle filenames using a [hash] placeholder pattern, enabling long-term caching. Current stable version is 1.3.0, last updated in 2019. It supports configurable hash algorithms (md5, sha1, sha256, sha512), truncation via [hash:N], optional manifest generation mapping original to hashed filenames, and a replace option to overwrite the original output. Release cadence is low; package is in maintenance mode. Differentiators include simplicity and explicit manifest support, though it is not actively developed and may lack native Rollup v2+ plugin API compliance.","status":"maintenance","version":"1.3.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/phamann/rollup-plugin-hash","tags":["javascript","rollup","rollup-plugin","hash","rev"],"install":[{"cmd":"npm install rollup-plugin-hash","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-hash","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-hash","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The plugin exports a default function, not a named export.","wrong":"import { hash } from 'rollup-plugin-hash'","symbol":"default","correct":"import hash from 'rollup-plugin-hash'"},{"note":"CommonJS require returns the plugin function directly; destructuring is incorrect.","wrong":"const { hash } = require('rollup-plugin-hash')","symbol":"default","correct":"const hash = require('rollup-plugin-hash')"},{"note":"TypeScript types for the plugin are not bundled; rely on Rollup's types.","wrong":"","symbol":"RollupOptions","correct":"import type { RollupOptions } from 'rollup'"}],"quickstart":{"code":"import { rollup } from 'rollup';\nimport hash from 'rollup-plugin-hash';\n\nasync function build() {\n  const bundle = await rollup({\n    input: 'src/index.js',\n    plugins: [\n      hash({\n        dest: 'dist/bundle.[hash:8].js',\n        manifest: 'dist/manifest.json'\n      })\n    ]\n  });\n  await bundle.write({ format: 'iife', file: 'dist/bundle.js' });\n}\nbuild().catch(console.error);","lang":"javascript","description":"Basic Rollup build with rollup-plugin-hash: generates hashed output filename and writes a manifest file."},"warnings":[{"fix":"Set output.file to the non-hashed name and use plugin's dest option.","message":"The plugin does not support Rollup's output.file option directly; it renames after write, which may conflict with other plugins.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Consider alternatives like rollup-plugin-output-manifest or manual hash generation.","message":"Package is no longer actively maintained; last release 2019. No updates for Rollup v3+ compatibility.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use a single output; for multiple outputs, consider using generateBundle hook plugins.","message":"Plugin uses writeBundle hook; it may fail if Rollup generates multiple outputs (e.g., multiple formats).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always include '[hash]' in dest template.","message":"The [hash] placeholder must be in dest option; omitting it throws an error.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Add [hash] to dest, e.g., dest: 'bundle.[hash].js'","cause":"Missing [hash] in dest string.","error":"Error: rollup-plugin-hash: dest option must contain [hash] placeholder"},{"fix":"Use import hash from 'rollup-plugin-hash' (no curly braces).","cause":"Using named import instead of default import.","error":"TypeError: hash is not a function"},{"fix":"Run npm install --save-dev rollup-plugin-hash","cause":"Package not installed or wrong Node.js version (requires Node >=8).","error":"Error: Cannot find module 'rollup-plugin-hash'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}