webpack-mode

1.1.0 • Public • Published

webpack-mode

Build Status

Get easily environment mode of Webpack build. Works only with Webpack 4.

Install

Simply run in terminal:

npm add --save-dev webpack-mode

or (if you use Yarn)

yarn add --dev webpack-mode

Usage

When you run webpack --mode=production or NODE_ENV=production webpack

// webpack.config.js
const { isProduction } = require("webpack-mode");

console.log(isProduction); // => true

// ... rest of the config

API

When you run webpack --mode=development

const webpackMode = require("webpack-mode");

webpackMode.isProduction; // false
webpackMode.isDevelopment; // true

webpackMode == "development"; // true
webpackMode === "development"; // false - webpackMode is not a string

console.log(`${webpackMode}`); // 'development'

Package Sidebar

Install

npm i webpack-mode

Weekly Downloads

288

Version

1.1.0

License

ISC

Unpacked Size

2.94 kB

Total Files

8

Last publish

Collaborators

  • mckomo