regexp-replace-loader

A webpack loader to replace a regexp pattern with a string

Showing:

Popularity

Downloads/wk

4.1K

GitHub Stars

7

Maintenance

Last Commit

4yrs ago

Contributors

4

Package

Dependencies

1

Size (min+gzip)

22.6KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

regexp-replace-loader

A webpack loader to replace a regexp pattern with a string

Installation

npm install regexp-replace-loader

Usage

webpack 2.x
// webpack.config.js
...
module: {
  rules: [
    {
      test: /\.js$/,
      loader: 'regexp-replace-loader',
      options: {
        match: {
          pattern: 'ba(r|z)',
          flags: 'g'
        },
        replaceWith: 'foo'
      }
    }
  ]
}
webpack 1.x
// webpack.config.js
...
module: {
  loaders: [
    {
      test: /\.js$/,
      loader: 'regexp-replace-loader',
      query: {
        match: {
          pattern: 'ba(r|z)',
          flags: 'g'
        },
        replaceWith: 'foo'
      }
    }
  ]
}

All instances of "bar" and "baz" will then be replaced by "foo".

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100