Mode
string
The following string values are supported:
Option
Description
development
Sets process.env.NODE_ENV
on DefinePlugin
to value development
. Enables NamedChunksPlugin
and NamedModulesPlugin
.
production
Sets process.env.NODE_ENV
on DefinePlugin
to value production
. Enables FlagDependencyUsagePlugin
, FlagIncludedChunksPlugin
, ModuleConcatenationPlugin
, NoEmitOnErrorsPlugin
, OccurrenceOrderPlugin
, SideEffectsFlagPlugin
and UglifyJsPlugin
.
none
Opts out of any default optimization options
If not set, webpack sets production
as the default value for mode
. The supported values for mode are:
Please remember that setting
NODE_ENV
doesn't automatically set mode
.
Mode: production
Mode: none
f you want to change the behavior according to the mode variable inside the webpack.config.js, you have to export a function instead of an object: