How to configure multiple interface addresses for webpake

vue project, how to configure multiple interface addresses for webpake (does not refer to different addresses for raw development and production environments).

the address of the interface server provided by the background is different, and different interface addresses are configured with agents in the development environment, but can multiple addresses be configured in the prod.env.js file when build

related codes

/ / Agent is configured in config

proxyTable: {
  "/Wei":{
    target: "http://xxx.xxx.xxx.1:8686",
    changeOrigin: true,
    pathRewrite: {
      "^/Wei": "/Wei"
    },
  },
  "/ios":{
    target: "http://xxx.xxx.xxx.2:8014",
    changeOrigin: true,
    pathRewrite: {
      "^/ios": "/ios"
    },
  },
},

/ / prod.env.js file

"use strict"
module.exports = {
  NODE_ENV: ""production"",
  // BASE_API: ""http://xxx.xxx.xxx.1:8686"",
  // BASE_API: ""http://xxx.xxx.xxx.2:8014"",
}

I don"t know how to configure multiple interface addresses in production environment.

add. After the axios, I use sets the interface address with different names in the prod.env.js, the baseURL configured for the axios can control which interface name to take through the parameters. Control parameters when requested. It feels a little troublesome.

Jul.28,2021

just use a different name in prod.env.js

Menu