Registry / devops / rollup-redis-cache

rollup-redis-cache

JSON →
library1.3.0jsnpmunverified

A Rollup plugin that accelerates builds by caching plugin transformations (e.g., @rollup/plugin-commonjs, @rollup/plugin-node-resolve, @rollup/plugin-babel) and prebuilding npm dependencies into separate bundles. Current stable version is 1.3.0, with irregular releases. Unlike Rollup's built-in in-memory cache, this persists to disk, speeding up initial builds and non-watch builds. Supports TypeScript types, ESM only, and requires a Redis backend.

npm install rollup-redis-cache
INSTALL
IMPORT
SIG · ROLLUP-REDIS-CACHE
R
rollup-redis-cache
devopsjavascriptv1.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

cacheBuild
import { cacheBuild } from 'rollup-cache'
const { cacheBuild } = require('rollup-cache')
ESM-only; CJS require will throw because package type is module.
type CacheConfig
import type { CacheConfig } from 'rollup-cache'
import { CacheConfig } from 'rollup-cache'
CacheConfig is exported as a type only.
default
import rollupCache from 'rollup-cache'
Default export is the same as named export cacheBuild; but using default is not recommended as it may be deprecated.

Configures Rollup with disk caching, plugin caching enabled automatically, and prebuilding lodash into a separate bundle.

// rollup.config.js import { cacheBuild } from 'rollup-cache'; import resolve from '@rollup/plugin-node-resolve'; export default cacheBuild( { name: 'my-app', enabled: process.env.NODE_ENV !== 'production', dependencies: ['rollup.config.js'], prebuild: ['lodash'], }, { input: 'src/main.js', output: { dir: 'dist', format: 'es', }, plugins: [resolve()], } );
Debug
Known issues
breakingRequires Rollup >=2.0.0
fix
Upgrade Rollup to version 2.0.0 or higher.
affects: <2.0.0
deprecatedDefault export may be removed in future versions; use named export cacheBuild.
fix
Replace 'import rollupCache from "rollup-cache"' with 'import { cacheBuild } from "rollup-cache"'.
affects: >=1.0.0
gotchaPlugin caching only works with official plugins by default (commonjs, node-resolve, babel). Custom plugins are not cached.
fix
If you need caching for other plugins, open an issue or implement custom caching via wrapper.
affects: >=1.0.0
gotchaPrebuilding requires output format 'es' and script type module in HTML.
fix
Set output.format to 'es' in your rollup config and use <script type="module"> in HTML.
affects: >=1.0.0
breakingRedis is required but not documented in the main README; failing to configure Redis will cause build to hang.
fix
Install and run Redis, or use the Redis_HOST and Redis_PORT environment variables to point to an existing instance.
affects: >=1.0.0
deprecatedThe option 'enabled' defaults to false in production (NODE_ENV=production). Do not rely on default; set explicitly.
fix
Always set 'enabled' in cacheConfig to avoid unintended cache disable in production.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /path/to/node_modules/rollup-cache/index.js
Package is ESM-only, but required with require().
fix
Use import syntax or set "type": "module" in package.json.
TypeError: rollupCache is not a function
Default export is not a function; use named export cacheBuild.
fix
Replace default import with: import { cacheBuild } from 'rollup-cache'
Error: Redis connection refused. Ensure Redis is running.
Redis is not installed or not accessible.
fix
Install and start Redis server, or set environment variables Redis_HOST and Redis_PORT.
[!] Error: Prebuild requires output.format to be 'es'. Current format is 'cjs'.
Prebuild feature only works with ES module output.
fix
Set output.format to 'es' in your rollup config.
Upgrade
Version history
1.3.0latest on npm
Audit
Dependencies
ioredisrequiredRedis client for caching
rolluprequiredPeer dependency; plugin requires Rollup >=2.0.0
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-redis-cache — npm install rollup-redis-cache · libregistry