1.0.5 • Published 7 years ago

if-webpack-plugin v1.0.5

Weekly downloads
79
License
MIT
Repository
github
Last release
7 years ago

If Webpack Plugin

npm

Installation

npm install --save-dev if-webpack-plugin

or

yarn add -D if-webpack-plugin

Usage

In your Webpack configuration in the plugins section:

// webpack.config.js
const IfPlugin = require('if-webpack-plugin')
const SuperCoolPlugin = require('super-cool-webpack-plugin')
const LessCoolPlugin = require('less-cool-webpack-plugin')
module.exports = {
  // ...
  plugins: [
    new IfPlugin(
      foo === 'bar',
      new SuperCoolPlugin(),
      new LessCoolPlugin()
    )
  ]
}

The third argument can also be omitted in order to include an empty plugin, i.e. a plugin that simply does nothing:

// webpack.config.js
const IfPlugin = require('if-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
module.exports = {
  // ...
  plugins: [
    new IfPlugin(
      process.env.NODE_ENV === 'production',
      new UglifyJsPlugin()
    )
  ]
}
1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago