cross-env cross-platform set up and use environment variables
In most cases, the windows platform is similar: NODE_ENV = production of command line instructions will be stuck, windows platform and POSIX using the command line there are many differences (eg POSIX, use $ ENV_VAR, in windows, use% ENV_VAR% ...)
cross-env makes that simple and different platforms use a unique command, without worrying about cross-platform issues
npm安装方式
npm i --save-dev cross-env
In npm script (mostly package.json) in such a configuration
{ "scripts": { "build": "cross-env NODE_ENV=production webpack --config build/webpack.config.js" } }
Run npm run build, so NODE_ENV they set up, without worrying about cross-platform issues
Original link: https://www.cnblogs.com/yanze/p/7879631.html