Registry / devops / rollup-plugin-hash

rollup-plugin-hash

JSON →
library1.3.0jsnpmunverified

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.

npm install rollup-plugin-hash
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-HASH
R
rollup-plugin-hash
devopsjavascriptv1.3.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import hash from 'rollup-plugin-hash'
✗ import { hash } from 'rollup-plugin-hash'
The plugin exports a default function, not a named export.
default
✓ const hash = require('rollup-plugin-hash')
✗ const { hash } = require('rollup-plugin-hash')
CommonJS require returns the plugin function directly; destructuring is incorrect.
RollupOptions
✓ import type { RollupOptions } from 'rollup'
TypeScript types for the plugin are not bundled; rely on Rollup's types.

Basic Rollup build with rollup-plugin-hash: generates hashed output filename and writes a manifest file.

import { rollup } from 'rollup'; import hash from 'rollup-plugin-hash'; async function build() { const bundle = await rollup({ input: 'src/index.js', plugins: [ hash({ dest: 'dist/bundle.[hash:8].js', manifest: 'dist/manifest.json' }) ] }); await bundle.write({ format: 'iife', file: 'dist/bundle.js' }); } build().catch(console.error);
Debug
Known issues
breakingThe plugin does not support Rollup's output.file option directly; it renames after write, which may conflict with other plugins.
fix
Set output.file to the non-hashed name and use plugin's dest option.
affects: >=1.0.0
deprecatedPackage is no longer actively maintained; last release 2019. No updates for Rollup v3+ compatibility.
fix
Consider alternatives like rollup-plugin-output-manifest or manual hash generation.
affects: >=1.0.0
gotchaPlugin uses writeBundle hook; it may fail if Rollup generates multiple outputs (e.g., multiple formats).
fix
Use a single output; for multiple outputs, consider using generateBundle hook plugins.
affects: >=1.0.0
gotchaThe [hash] placeholder must be in dest option; omitting it throws an error.
fix
Always include '[hash]' in dest template.
affects: >=1.0.0
Errors
Common errors & fixes
Error: rollup-plugin-hash: dest option must contain [hash] placeholder
Missing [hash] in dest string.
fix
Add [hash] to dest, e.g., dest: 'bundle.[hash].js'
TypeError: hash is not a function
Using named import instead of default import.
fix
Use import hash from 'rollup-plugin-hash' (no curly braces).
Error: Cannot find module 'rollup-plugin-hash'
Package not installed or wrong Node.js version (requires Node >=8).
fix
Run npm install --save-dev rollup-plugin-hash
Upgrade
Version history
1.3.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
4
Resources
rollup-plugin-hash — npm install rollup-plugin-hash · libregistry