Skip to content
This repository has been archived by the owner on Sep 19, 2020. It is now read-only.

EventMobi/regexp-replace-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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".

About

A webpack loader to replace a regexp pattern with a string

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •