西藏巴青项目

vite.config.js 904B

1234567891011121314151617181920212223242526272829303132
  1. import { defineConfig } from 'vite'
  2. import uni from '@dcloudio/vite-plugin-uni'
  3. import { LLM_PROXY_TARGET } from './config/llm.js'
  4. /** 与 config/index.js 中 DEV_API_HOST 保持一致 */
  5. const DEV_API_TARGET = 'http://192.168.1.10:8010'
  6. const llmTarget = String(LLM_PROXY_TARGET || '').replace(/\/$/, '')
  7. /**
  8. * uni-app Vue3 H5 开发代理(Vite rewrite)
  9. * - /dev-api → 若依后端(config/index.js H5_USE_PROXY)
  10. * - /llm-dev-proxy → 大模型网关(对齐 ruoyi-ui/vue.config.js devProxy)
  11. */
  12. export default defineConfig({
  13. plugins: [uni()],
  14. server: {
  15. proxy: {
  16. '/dev-api': {
  17. target: DEV_API_TARGET,
  18. changeOrigin: true,
  19. rewrite: (path) => path.replace(/^\/dev-api/, '')
  20. },
  21. '/llm-dev-proxy': {
  22. target: llmTarget,
  23. changeOrigin: true,
  24. rewrite: (path) => path.replace(/^\/llm-dev-proxy/, '')
  25. }
  26. }
  27. }
  28. })