New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

webpack-replace

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-replace

Replace loader for Webpack

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
124
63.16%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

webpack

FAQs

Package last updated on 22 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts