1.0.0 • Published 10 years ago

webpack-replace v1.0.0

Weekly downloads
1,457
License
MIT
Repository
github
Last release
10 years ago

Replace loader for Webpack

Perform replacements (plain and regular expression) in the contents loaded by the loader.

Install:

$ npm install --save-dev webpack-replace

Usage:

Add the loader to your webpack.config.js:

Single replacement:

module.exports = {
    // ...
    module: {
      loaders: [
        {
          test: /fileInWhichJQueryIsUndefined\.js$/,
          loader: 'webpack-replace',
          query: {
            search: 'jQuery',
            replace: 'window.$'
          }
        }
      ]
    }
}

Multiple replacements at once:

module.exports = {
    // ...
    module: {
      loaders: [
        {
          test: /\.js$/,
          loader: 'webpack-replace',
          query: {
            replace: [{
              from: 'jQuery',
              to: 'window.$'
            }]
          }
        }
      ]
    }
}

Contributing:

Feel free to open issues to propose stuff and participate. Pull requests are also welcome.

Licence:

MIT