module.exports = defineConfig({
transpileDependencies: true,
lintOnSave: false,
outputDir: 'dist',
configureWebpack: {
// provide the app's title in webpack's name field, so that
// it can be accessed in index.html to inject the correct title.
// name: name,
resolve: {
alias: {
'@': resolve('src')
}
}
},
devServer: {
host: 'localhost',
port: 8080,
proxy: {
'/api': {
// target: 'http://192.168.xx.xx:8xxx', // 开发
target:'https://test.xxx.com.cn:xxx', //测试
changeOrigin: true, // 是否开启跨域
pathRewrite: {
//重写路径
// '^/api': '/api' // 这种接口配置出来 http://XX.XX.XX.XX:8083/api/login
'^/api': '/' // 这种接口配置出来 http://XX.XX.XX.XX:8083/login
}
},
}
},
})
vue.config.js 跨域配置
猜你喜欢
转载自blog.csdn.net/Ann_52547/article/details/130486351
今日推荐
周排行