For setting NODE_ENV you can use any of these methods.

method 1: set NODE_ENV for all node apps

Windows:

set NODE_ENV=production

Linux or other Unix based system:

export NODE_ENV=production

method 2:set NODE_ENV for current app

NODE_ENV=production node app.js

method 3: create .env file and use env-cmd package

env-cmd .env node app.js

method 4: use cross-env pacakge

in package.json

"build:deploy":"cross-env NODE_ENV=production webpack"

 

posted @ 2020-01-20 15:19  lishidefengchen  阅读(126)  评论(0编辑  收藏  举报