vite.config.mjs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. rewrite: (path) => path.replace(/^\/proxy_url/, '')
  28. },
  29. '/dify': {
  30. target: 'http://192.168.20.119:28003/',
  31. changeOrigin: true,
  32. secure: false,
  33. ws: true,
  34. rewrite: (path) => path.replace(/^\/dify/, '')
  35. },
  36. '/rgflow': {
  37. target: 'http://192.168.20.119:28002/',
  38. changeOrigin: true,
  39. secure: false,
  40. ws: true,
  41. rewrite: (path) => path.replace(/^\/rgflow/, '')
  42. }
  43. }
  44. },
  45. build: {
  46. /**
  47. * 构建输出目录,相对于 src/index.html 文件
  48. * @see https://cn.vite.dev/config/build-options.html#build-outdir
  49. */
  50. outDir: '../dist',
  51. emptyOutDir: true
  52. },
  53. plugins: [
  54. vue(),
  55. /**
  56. * @see https://devtools.vuejs.org/guide/vite-plugin
  57. */
  58. vueDevTools({
  59. launchEditor: 'code'
  60. })
  61. ]
  62. });