@types/string-replace-webpack-plugin
TypeScript icon, indicating that this package has built-in type declarations

0.1.6 • Public • Published

Installation

npm install --save @types/string-replace-webpack-plugin

Summary

This package contains type definitions for string-replace-webpack-plugin (https://github.com/jamesandersen/string-replace-webpack-plugin).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/string-replace-webpack-plugin.

index.d.ts

import { Plugin, RuleSetUse } from "webpack";

export = StringReplacePlugin;

declare class StringReplacePlugin extends Plugin {
    static replace(
        options: StringReplacePlugin.Options,
        /**
         * loaders to follow the replacement
         */
        nextLoaders?: string,
    ): RuleSetUse;
    static replace(
        /**
         * loaders to apply prior to the replacement
         */
        prevLoaders: string,
        options: StringReplacePlugin.Options,
        /**
         * loaders to follow the replacement
         */
        nextLoaders?: string,
    ): RuleSetUse;
}

declare namespace StringReplacePlugin {
    interface Options {
        replacements: ReplacementItem[];
    }

    interface ReplacementItem {
        /**
         * a regex to match against the file contents
         */
        pattern: RegExp;
        /**
         * an ECMAScript string replacement function
         * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_function_as_a_parameter
         */
        replacement: (substring: string, ...args: any[]) => string;
    }
}

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: @types/webpack

Credits

These definitions were written by Rongjian Zhang.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/string-replace-webpack-plugin

Weekly Downloads

2,875

Version

0.1.6

License

MIT

Unpacked Size

5.11 kB

Total Files

5

Last publish

Collaborators

  • types