vite.config.mjs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import { defineConfig } from 'vite';
  2. import vue from '@vitejs/plugin-vue';
  3. import vueDevTools from 'vite-plugin-vue-devtools';
  4. // import path from 'path'; // 导入 path 模块
  5. // https://vitejs.dev/config/
  6. export default defineConfig({
  7. /**
  8. * 项目根目录
  9. * @see https://cn.vite.dev/config/shared-options.html#root
  10. */
  11. root: './src',
  12. /**
  13. * 静态资源目录,相对于 src/index.html 文件
  14. * @see https://cn.vite.dev/config/shared-options.html#publicdir
  15. */
  16. publicDir: '../public',
  17. server: {
  18. port: 5173,
  19. host: '0.0.0.0', // IP配置,支持从IP启动
  20. proxy: {
  21. '/api/': {
  22. // target: 'http://192.168.20.119:9301',
  23. target: 'http://smartai.com:8191',
  24. changeOrigin: true,
  25. secure: false,
  26. ws: true,
  27. cors: true,
  28. rewrite: (path) => path.replace(/^\/proxy_url/, '')
  29. },
  30. '/dify': {
  31. target: 'http://192.168.20.119:28003/',
  32. changeOrigin: true,
  33. secure: false,
  34. ws: true,
  35. rewrite: (path) => path.replace(/^\/dify/, '')
  36. },
  37. '/rgflow': {
  38. target: 'http://192.168.20.119:28002/',
  39. changeOrigin: true,
  40. secure: false,
  41. ws: true,
  42. rewrite: (path) => path.replace(/^\/rgflow/, '')
  43. }
  44. }
  45. },
  46. build: {
  47. /**
  48. * 构建输出目录,相对于 src/index.html 文件
  49. * @see https://cn.vite.dev/config/build-options.html#build-outdir
  50. */
  51. outDir: '../dist',
  52. emptyOutDir: true
  53. },
  54. plugins: [
  55. vue(),
  56. /**
  57. * @see https://devtools.vuejs.org/guide/vite-plugin
  58. */
  59. vueDevTools({
  60. launchEditor: 'code'
  61. })
  62. ]
  63. });