// const { defineConfig } = require('@vue/cli-service') // module.exports = defineConfig({ // transpileDependencies: true // }) const { defineConfig } = require('@vue/cli-service') module.exports = defineConfig({ devServer: { proxy: { // 代理所有以 /api 开头的请求 '/api': { target: 'http://192.168.40.48:8081', // 你的后端地址 changeOrigin: true, // 允许跨域 pathRewrite: { '^/api': '' // 重写路径,去掉 /api 前缀 }, secure: false, // 如果是https接口,需要配置这个参数 logLevel: 'debug' // 查看代理日志 }, // 可以配置多个代理 '/upload': { target: 'http://localhost:3000', changeOrigin: true } }, // 允许外部访问 host: '0.0.0.0', port: 8080 } })