webpack node env variable code example
Example: set env production webpack build
// webpack.config.js
module.exports = env => {
const isProduction = env.NODE_ENV === 'production'
// ...
return {
// ...
}
}
// package.json
{
...
"scripts": {
"build": "webpack --env.NODE_ENV=production"
},
...
}