vite.config.mjs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import { defineConfig, loadEnv } from 'vite';
  2. import vue from '@vitejs/plugin-vue';
  3. import vueDevTools from 'vite-plugin-vue-devtools';
  4. // https://vitejs.dev/config/
  5. export default defineConfig(({ mode }) => {
  6. // const env = loadEnv(mode, process.cwd());
  7. return {
  8. /**
  9. * 项目根目录
  10. * @see https://cn.vite.dev/config/shared-options.html#root
  11. */
  12. root: './src',
  13. /**
  14. * 静态资源目录,相对于 src/index.html 文件
  15. * @see https://cn.vite.dev/config/shared-options.html#publicdir
  16. */
  17. publicDir: '../public',
  18. server: {
  19. port: 5173,
  20. host: '0.0.0.0', // IP配置,支持从IP启动
  21. proxy: {
  22. '/api/': {
  23. target: 'http://smartai.com:8401',
  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. };
  64. });