//配置参数
/**
* devServer.proxy
* 前端应用和后端 API 服务器没有运行在同一个主机上,需要在开发环境下将 API 请 求代理到 API 服务器
*/
module.exports = {
devServer: {
proxy: {
'/api': {
target: 'http://localhost:8989',//地址
ws: true,
changeOrigin: true,
pathRewrite:{//重写路径
'^/api':''
}
},
},
},
configureWebpack: (config) => {
config.resolve = {
extensions: ['.js', '.json', '.vue'],
alias: {
'@': path.resolve(__dirname, './src')
}
}
}
}
配置文件vue.config.js
最新推荐文章于 2024-06-04 15:02:46 发布