Vue-cli3.0 .env.development cannot get the devServer.proxy in vue.config.js

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": ""
        }
      }
    }
  }
};


clipboard.png
finally print

in the request.js encapsulating axios
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

.
Sep.30,2021

'/ api'

print definitely printed api have your requested address changed? I see nothing wrong with your configuration

I have the same problem solved

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e3c627-4469c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e3c627-4469c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?