webpack4获取env变量参数
#bash
[root@localhost] webpack-cli --env development
#webpack.config.js
module.exports = function (env, args) {
return {
mode: env || 'development',
entry: "./src/app.js",
output: {
filename: "app.js",
path: path.resolve(__dirname, env === 'development' ? 'dist': 'public')
}
}
};