devServer: {api
port: 9878,ide
open: true,ui
overlay: {server
warnings: false,get
errors: true域名
},it
proxy: {io
"/a_api": {class
target: "http://127.0.0.1:3003",require
changeOrigin: true, // 是否改變域名
ws: true,
pathRewrite: {
// 路徑重寫
"/a_api": "" // 這個意思就是以api開頭的,定向到哪裏, 若是你的後邊還有路徑的話, 會自動拼接上
}
}
}
// before: require('./mock/mock-server.js')
}
另:.env.development 配置
# just a flag
ENV = 'development'
# base api
VUE_APP_BASE_API = '/a_api'
另:.env.production配置
# just a flag
ENV = 'production'
# base api VUE_APP_BASE_API = '/a_api'