Skip to content

mckomo/webpack-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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'

About

Get current mode of Webpack 4 build

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published