npm scripts设置环境变量方法

  • windows
set NODE_ENV=production

"scripts": {
    "release": "set NODE_ENV=production && gulp rtm",
    "dev": "set NODE_ENV=development && gulp watch",
}
  • linux&mac
export NODE_ENV=production

"scripts": {
    "release": "NODE_ENV=production gulp rtm",
    "dev": "NODE_ENV=development gulp watch",
}
  • 跨平台
npm i cross-env -D

"scripts": {
    "release": "cross-env NODE_ENV=production gulp rtm",
    "dev": "cross-env NODE_ENV=development gulp watch",
}

转—https://www.cnblogs.com/mengff/p/7350030.html

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页