2025-10-14 18:04:20 +08:00
|
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
|
|
import uni from '@dcloudio/vite-plugin-uni'
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
|
plugins: [
|
|
|
|
|
|
uni(),
|
|
|
|
|
|
],
|
2025-10-27 15:03:40 +08:00
|
|
|
|
server: {
|
|
|
|
|
|
proxy: {
|
|
|
|
|
|
'/api': {
|
2025-12-04 15:32:55 +08:00
|
|
|
|
target: 'http://192.168.1.111:58080', // 请替换为你的实际后端服务器地址
|
2025-10-27 15:03:40 +08:00
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
rewrite: (path) => path.replace(/^\/api/, '/api')
|
2025-12-04 15:32:55 +08:00
|
|
|
|
},
|
|
|
|
|
|
'/baidu-translate': {
|
|
|
|
|
|
target: 'https://fanyi-api.baidu.com', // 百度翻译API的基础地址
|
|
|
|
|
|
changeOrigin: true, // 修改请求头中的Origin,模拟同源请求
|
|
|
|
|
|
rewrite: (path) => path.replace(/^\/baidu-translate/, '') // 移除代理前缀
|
2025-10-27 15:03:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-10-14 18:04:20 +08:00
|
|
|
|
})
|