Registry / devops / rollup-plugin-re

rollup-plugin-re

JSON →
library1.0.7jsnpmunverified

A Rollup plugin for content transformation using regex patterns, string replacements, define macros, and custom transforms. Version 1.0.7 is the latest stable release, but the package appears unmaintained since 2018. It allows multiple replace patterns, include/exclude filters, and supports replacing by regex, string, file content, or custom transform function. Differentiates from @rollup/plugin-replace by offering pattern-based and macro-based replacements alongside simple string replacements.

npm install rollup-plugin-re
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-RE
R
rollup-plugin-re
devopsjavascriptv1.0.7
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

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

replace
import replace from 'rollup-plugin-re'
import { replace } from 'rollup-plugin-re'
This package uses a default export. Named import will be undefined.
replace
const replace = require('rollup-plugin-re').default
const replace = require('rollup-plugin-re')
In CommonJS, require returns the module exports object; default export is at .default.
types
import type { RollupPluginReOptions } from 'rollup-plugin-re'
TypeScript types are included in the package. You can import the options interface for type safety.

Basic Rollup setup using rollup-plugin-re for define macros, string replacements, and regex-based replacements.

import { rollup } from 'rollup'; import replace from 'rollup-plugin-re'; rollup({ input: 'src/main.js', plugins: [ replace({ include: '**/*.js', excludes: 'node_modules/**', defines: { DEBUG: false, }, replaces: { __VERSION__: '1.0.0', }, patterns: [ { test: /process\.env\.NODE_ENV/, replace: '"production"', }, ], }), ], output: { file: 'bundle.js', format: 'cjs', }, }).then(() => console.log('done'));
Debug
Known issues
deprecatedPackage is no longer maintained. Use @rollup/plugin-replace or modern alternatives.
fix
Migrate to @rollup/plugin-replace for simple string replacements, or use rollup-plugin-string-replace for regex support.
affects: >=0.0.0
gotchaThe 'excludes' option is misspelled as 'excludes' in code examples, but actually 'exclude' is correct.
fix
Use 'exclude' instead of 'excludes' in the plugin options object.
affects: >=0.0.0
gotchaPatterns with 'match' property are not applied correctly; 'match' is intended for internal file matching but may cause confusion.
fix
Avoid using 'match'; use 'include'/'exclude' for file filtering and 'test'/'replace' for content transformation.
affects: >=1.0.0
gotchaThe 'transform' function in a pattern must return a string; returning an object with 'code' and 'map' is not supported.
fix
Return only the transformed code string from transform functions.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: replace is not a function
Using named import instead of default import.
fix
Use: import replace from 'rollup-plugin-re' (without curly braces).
Error: Cannot find module 'minimatch'
Missing dependency 'minimatch' (it is not a peer dependency but required at runtime).
fix
Run: npm install minimatch --save-dev
The 'excludes' option is not recognized. Did you mean 'exclude'?
Typo in option name: 'excludes' instead of 'exclude'.
fix
Change option name to 'exclude'.
Upgrade
Version history
1.0.7latest on npm
Audit
Dependencies
rolluprequiredPeer dependency: works as a Rollup plugin
minimatchrequiredUsed for include/exclude pattern matching
Agent activity
2 hits · last 30 days
node
2
Resources
rollup-plugin-re — npm install rollup-plugin-re · libregistry