the environmental background of the problems and what methods you have tried
Development environment: vue 3.0.4
vue-cli 3.0
node v8.11.0
related codes
.env.development file code
VUE_APP_BASE_API=/api
vue.config.js file code
module.exports = {
productionSourceMap: false,
assetsDir: "static/xxx",
devServer: {
proxy: {
"/api": {
target: "https://www.xxx.com",
changeOrigin: true,
pathRewrite: {
"^/api": ""
}
}
}
}
};
finally print
console.log("request", process.env.VUE_APP_BASE_API);
/api
what result do you expect?
does not print a cross-domain address. I hope someone can take a look at it
.