| 1234567891011121314151617181920212223242526272829303132 |
- import { defineConfig } from 'vite'
- import uni from '@dcloudio/vite-plugin-uni'
- import { LLM_PROXY_TARGET } from './config/llm.js'
- /** 与 config/index.js 中 DEV_API_HOST 保持一致 */
- const DEV_API_TARGET = 'http://192.168.1.10:8010'
- const llmTarget = String(LLM_PROXY_TARGET || '').replace(/\/$/, '')
- /**
- * uni-app Vue3 H5 开发代理(Vite rewrite)
- * - /dev-api → 若依后端(config/index.js H5_USE_PROXY)
- * - /llm-dev-proxy → 大模型网关(对齐 ruoyi-ui/vue.config.js devProxy)
- */
- export default defineConfig({
- plugins: [uni()],
- server: {
- proxy: {
- '/dev-api': {
- target: DEV_API_TARGET,
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/dev-api/, '')
- },
- '/llm-dev-proxy': {
- target: llmTarget,
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/llm-dev-proxy/, '')
- }
- }
- }
- })
|