const { defineConfig } = require('@vue/cli-service'); module.exports = defineConfig({ transpileDependencies: true, lintOnSave: false, // 配置正向代理 devServer: { proxy: { '/api/v1': { // 代理请求的真正服务器地址, // 即 当你向 '/api/v1' 地址发起请求时,真正请求的地址为 // 'http://localhost:3000/api/v1' // 譬如:登录接口 http://localhost:3000/api/v1/user/login // 由于配置代理 因此 发起请求时 直接写'/api/v1/user/login target: 'http://localhost:3000', changeOrigin: true, }, '/public': { target: 'http://localhost:3000', changeOrigin: true, }, }, }, });