@jeffjade
2016-02-18T17:06:52.000000Z
字数 777
阅读 1415
Node.js
"scripts": {
"dev": "webpack-dev-server --inline --hot --quiet",
"build": "SET NODE_ENV=production && webpack --progress --hide-modules"
}
在以vue+webpack
折腾web前端开发时,作package.json
配置,当需要了解,node环境在Mac和Windows设置是有区别的,详情可参见stackoverflow的回答:
Before running your app, you can do this in console (Mac),
export NODE_ENV=production
Or if you are in windows you could try this:
SET NODE_ENV=production
or you can run your app like this:
NODE_ENV=production node app.js
You can also set it in your js file:
process.env.NODE_ENV = 'production';
But I don't suggest to do it in your runtime file, since it's not easy to open up VIM in your server and change it to production. You can make a config.json file in your directory and everytime your app runs, it reads from it and sets the configuration.