24 lines
820 B
JavaScript
24 lines
820 B
JavaScript
|
const proxy = require('http-proxy-middleware');
|
|||
|
|
|||
|
module.exports = {
|
|||
|
lintOnSave: false, // 关闭lint检查
|
|||
|
// host: '0.0.0.0'
|
|||
|
// 解决跨域
|
|||
|
devServer: {
|
|||
|
host: '127.0.0.1', // can be overwritten by process.env.HOST
|
|||
|
port: 9080,
|
|||
|
proxy: {
|
|||
|
'/api': {//代理器中设置/api,项目中请求路径为/api的替换为target
|
|||
|
// target: 'http://localhost:8082',
|
|||
|
target: 'http://192.168.2.105:8082',//代理地址,会代替axios中的baseUrl
|
|||
|
secure: false, // 使用的是http协议则设置为false,https协议则设置为true
|
|||
|
changOrigin: true, // 跨域
|
|||
|
ws: true,
|
|||
|
pathRewrite: {//重写url
|
|||
|
'^/api': '/'
|
|||
|
},
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|