Webpack4.0 npm script uses-- mode development to set development mode and production mode

use webpack4.0 to package
npm script

"webpack --mode development --config webpack.config.dev.js  --progress --colors  "

tell me how to use the-- mode field in the configuration file code to make a judgment

Feb.28,2021

https://doc.webpack-china.org.

ides/environment-variables" rel=" nofollow noreferrer "> use environment variables

the official example is to export a function instead of an exported object in a configuration file, where you can directly access the

of mode.
module.exports = (env, argv) => ({
  // ... 
  optimization: {
    minimize: false,
    //  argv  mode 
    minimizer: argv.mode === 'production' ? [
      new UglifyJsPlugin({ /*  */ }), 
      // 
      // mode  production  webpack  JS  plugin
    ] : [],
  },
})...

there are mode fields in the webpack configuration.. Just write directly.

config = {
    mode: 'development'
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e995d3-4750c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e995d3-4750c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?