vite.config.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import { fileURLToPath, URL } from 'node:url';
  2. import { defineConfig } from 'vite';
  3. import vue from '@vitejs/plugin-vue';
  4. import SvgLoader from 'vite-svg-loader';
  5. import legacyPlugin from '@vitejs/plugin-legacy';
  6. import Components from 'unplugin-vue-components/vite';
  7. import AutoImport from 'unplugin-auto-import/vite';
  8. export default defineConfig({
  9. base: './',
  10. plugins: [
  11. vue(),
  12. SvgLoader(),
  13. // ant design vue 按需加载
  14. Components({
  15. }),
  16. // 自动引入ref
  17. AutoImport({
  18. imports: ['vue', 'vue-router'],
  19. eslintrc: {
  20. enabled: true,
  21. filepath: './.eslintrc-auto-import.json',
  22. globalsPropValue: true
  23. },
  24. dts: './src/auto-import.d.ts'
  25. }),
  26. legacyPlugin({
  27. targets: ['defaults', 'chrome 52', 'ie >= 11','Safari >= 8'], // 需要兼容的目标列表,可以设置多个
  28. additionalLegacyPolyfills: ['regenerator-runtime/runtime'], // 面向IE11时需要此插件
  29. renderLegacyChunks: true,
  30. polyfills: true,
  31. modernPolyfills: true
  32. })
  33. ],
  34. build: {
  35. target: ['ios8', 'edge90', 'chrome52', 'firefox90', 'safari8']
  36. },
  37. resolve: {
  38. alias: {
  39. '@': fileURLToPath(new URL('./src', import.meta.url))
  40. }
  41. },
  42. server: {
  43. cors: true,
  44. proxy: {
  45. 'algorithmServer': {
  46. target: 'http://10.10.9.32:20331/',
  47. changeOrigin: true,
  48. rewrite: (path) => path.replace(/^\/algorithmServer/, '')
  49. },
  50. '/server': {
  51. target: 'http://localhost:7518',
  52. changeOrigin: true,
  53. rewrite: (path) => path.replace(/^\/server/, '')
  54. },
  55. '/chat': {
  56. // target: 'http://lq.lianqiai.cn:20333/chat',
  57. target: 'http://10.10.9.32:20331/',
  58. changeOrigin: true,
  59. rewrite: (path) => path.replace(/^\/chat/, '')
  60. },
  61. '/lianqiai2': {
  62. target: 'http://121.40.148.47:8530',
  63. changeOrigin: true,
  64. rewrite: (path) => path.replace(/^\/lianqiai2/, '')
  65. },
  66. '/lianqiai': {
  67. target: 'https://zjugpt.com/liqchat',
  68. changeOrigin: true,
  69. rewrite: function (path) {
  70. return path.replace(/^\/lianqiai/, '');
  71. }
  72. },
  73. '/knowledge': {
  74. target: 'http://121.40.148.47:8528/knowledge',
  75. changeOrigin: true,
  76. rewrite: (path) => path.replace(/^\/knowledge/, '')
  77. },
  78. '/geoserver-host': {
  79. target: 'http://60.191.110.204:8515',
  80. changeOrigin: true,
  81. rewrite: (path) => path.replace(/^\/geoserver-host/, '')
  82. },
  83. '/arcserver-host': {
  84. target: 'http://60.191.110.204:6080',
  85. changeOrigin: true,
  86. rewrite: (path) => path.replace(/^\/arcserver-host/, '')
  87. },
  88. '/deepseek': {
  89. target: 'https://ark.cn-beijing.volces.com',
  90. changeOrigin: true,
  91. rewrite: (path) => path.replace(/^\/deepseek/, '')
  92. },
  93. '/aiserver': {
  94. // target: 'http://localhost:7518/',
  95. target: 'https://ai.zrzyt.zj.gov.cn:10086',
  96. changeOrigin: true,
  97. rewrite: (path) => path.replace(/^\/aiserver/, '')
  98. },
  99. '/corsBaseUrl': {
  100. target: 'http://114.215.200.79:81/',
  101. changeOrigin: true,
  102. rewrite: (path) => path.replace(/^\/corsBaseUrl/, '')
  103. }
  104. }
  105. }
  106. });