const {defineConfig} = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
runtimeCompiler: true, // 开启编译模式
devServer: {
port: 80, // 设置前端服务器端口为80
proxy: {
'/api' : { // path以 /api开头的就走代理
target: 'http://localhost:8080/', // 后端服务器的地址
changeOrigin: true, // 是否跨域
pathRewrite: {
'^/api' : '/' // 重写path,去掉api
}
}
}
},
})
前后端分离项目配置跨域
最新推荐文章于 2024-01-08 09:40:37 发布