vite.config.js 991 B

1234567891011121314151617181920212223242526272829303132333435
  1. import {
  2. defineConfig
  3. } from 'vite'
  4. import vue from '@vitejs/plugin-vue'
  5. import path from 'path'
  6. // https://vite.dev/config/
  7. export default defineConfig({
  8. base: './',
  9. plugins: [vue()],
  10. resolve: {
  11. alias: {
  12. '@': path.resolve(__dirname, './src')
  13. }
  14. },
  15. server: {
  16. port: '8080',
  17. proxy: {
  18. '/apiV1': { // 配置需要代理的路径
  19. target: 'https://www.workark.com', // 目标地址 --> 服务器地址
  20. changeOrigin: true, // 允许跨域
  21. ws: true, // 允许websocket代理
  22. // 重写路径 --> 作用与vue配置pathRewrite作用相同
  23. rewrite: (path) => path.replace(/^\/apiV1/, "")
  24. },
  25. '/difyAPI': { // 配置需要代理的路径
  26. target: 'http://203.110.233.149:9000', // 目标地址 --> 服务器地址
  27. changeOrigin: true, // 允许跨域
  28. ws: true, // 允许websocket代理
  29. // 重写路径 --> 作用与vue配置pathRewrite作用相同
  30. rewrite: (path) => path.replace(/^\/difyAPI/, "")
  31. }
  32. },
  33. }
  34. })