开发环境,测试环境,生成环境 vue
development 开发环境(本地服务器)
stage (test) 测试环境 (测试服务器)
production 生产环境(正式服务器)
.env.development
# 开发环境
ENV = 'development'
# base api
VUE_APP_BASE_API = 'local.xxx.com'
.env.production
# 生成环境
ENV = 'production'
# base api
VUE_APP_BASE_API = 'www.xxx.com'
.env.staging
NODE_ENV = production
# 测试环境
ENV = 'staging'
# base api
VUE_APP_BASE_API = 'test.xxx.com'
package.json
"scripts": {
"dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging"
}