• Version 2.2.0
  • Published
  • 12.4 kB
  • 2 dependencies
  • MIT license


npm i rollup-plugin-replace
yarn add rollup-plugin-replace
pnpm add rollup-plugin-replace





function replace

replace: (options?: RollupReplaceOptions) => Plugin;
  • Replace strings in files while bundling them.


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?: string | RegExp | ReadonlyArray<string | RegExp> | null;
    • Files that should be excluded, if include is otherwise too permissive.

    property include

    include?: string | RegExp | ReadonlyArray<string | RegExp> | null;
    • 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 values

    values?: { [str: string]: Replacement };
    • You can separate values to replace from other options.

    index signature

    [str: string]:
    | Replacement
    | RollupReplaceOptions['include']
    | RollupReplaceOptions['values'];
    • 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 (12)

      Peer Dependencies (0)

      No peer dependencies.


      To add a badge like this badgeto your package's README, use the codes available below.

      You may also use to create a custom badge linking to

      • Markdown
      • HTML
        <a href=""><img src="" alt=""></a>