@rollup/plugin-replace

  • Version 4.0.0
  • Published
  • 27.2 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

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 of foo, supply delimiters

    property exclude

    exclude?: FilterPattern;
    • Files that should be excluded, if include is otherwise too permissive.

    property include

    include?: FilterPattern;
    • A minimatch pattern, or array of patterns, of files that should be processed by this plugin (if omitted, all files are included by default)

    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['preventAssignment'];
    • All other options are treated as string: replacement replacers, or string: (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 onejsDocs.io badgeto 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>