webpack-null-plugin

0.0.2 • Public • Published

Installation

npm i -S webpack-null-plugin

Usage

This plugin uses the null object pattern to simplify webpack configs with conditional plugins.

For example, perhaps you only want to run the start-server-webpack-plugin plugin when the environment variable WEBPACK_START_SERVER equals 1:

const StartServerPlugin = require('start-server-webpack-plugin');
const NullPlugin = require('webpack-null-plugin');
const shouldRunServer = process.env.WEBPACK_START_SERVER === '1';
 
module.exports = {
  /* ...rest of config... */
  plugins: [
    shouldRunServer ? new StartServerPlugin('index.js') : new NullPlugin(),
  ],
};
 

Package Sidebar

Install

npm i webpack-null-plugin

Weekly Downloads

256

Version

0.0.2

License

ISC

Last publish

Collaborators

  • nathantreid