cross-env跨平台环境变量设置(开发环境)
安装
npm install --save-dev cross-env
使用
{
"scripts": {
"build": "cross-env NODE_ENV=production webpack --config build/webpack.config.js"
}
}
NODE_ENV环境变量将由cross-env设置
打印process.env.NODE_ENV === 'production '
"dev":"cross-env NODE-ENV=development node build/webpack.deb.conf.js"
"build --qa":"cross-env NODE_ENV=testing node build/build.js"
"build --prod":"cross-env NODE_ENV=production node build/build.js"