@rollup/plugin-replace
- Version 6.0.2
- Published
- 23.6 kB
- 2 dependencies
- MIT license
Install
npm i @rollup/plugin-replace
yarn add @rollup/plugin-replace
pnpm add @rollup/plugin-replace
Overview
Replace strings in files while bundling
Index
Functions
Interfaces
Type Aliases
Functions
function replace
replace: (options?: RollupReplaceOptions) => Plugin;
Replace strings in files while bundling them.
Interfaces
interface RollupReplaceOptions
interface RollupReplaceOptions {}
property delimiters
delimiters?: [string, string];
To replace every occurrence of
<@foo@>
instead of every occurrence offoo
, supply delimiters
property exclude
exclude?: FilterPattern;
Files that should be excluded, if
include
is otherwise too permissive.
property include
include?: FilterPattern;
A picomatch pattern, or array of patterns, of files that should be processed by this plugin (if omitted, all files are included by default)
property objectGuards
objectGuards?: boolean;
When replacing dot-separated object properties like
process.env.NODE_ENV
, will also replacetypeof process
object guard checks against the objects with the string"object"
.
property preventAssignment
preventAssignment?: boolean;
Prevents replacing strings where they are followed by a single equals sign.
property sourceMap
sourceMap?: boolean;
If false, skips source map generation. This will improve performance. true
property values
values?: { [str: string]: Replacement };
You can separate values to replace from other options.
index signature
[str: string]: | Replacement | RollupReplaceOptions['include'] | RollupReplaceOptions['values'] | RollupReplaceOptions['objectGuards'] | RollupReplaceOptions['preventAssignment'];
All other options are treated as
string: replacement
replacers, orstring: (id) => replacement
functions.
Type Aliases
type Replacement
type Replacement = string | ((id: string) => string);
Package Files (1)
Dependencies (2)
Dev Dependencies (6)
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@rollup/plugin-replace
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@rollup/plugin-replace)
- HTML<a href="https://www.jsdocs.io/package/@rollup/plugin-replace"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3310 ms. - Missing or incorrect documentation? Open an issue for this package.