vite.config.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { defineApplicationConfig } from '@vben/vite-config';
  2. import Inspector from 'vite-plugin-vue-inspector';
  3. export default defineApplicationConfig({
  4. overrides: {
  5. optimizeDeps: {
  6. include: [
  7. 'echarts/core',
  8. 'echarts/charts',
  9. 'echarts/components',
  10. 'echarts/renderers',
  11. 'qrcode',
  12. '@iconify/iconify',
  13. 'ant-design-vue/es/locale/zh_CN',
  14. 'ant-design-vue/es/locale/en_US',
  15. 'vxe-table/lib/locale/lang/zh-CN',
  16. 'vxe-table/es/locale/lang/en-US',
  17. ],
  18. },
  19. server: {
  20. proxy: {
  21. '/basic-api': {
  22. target: 'http://localhost:8080',
  23. changeOrigin: true,
  24. ws: true,
  25. rewrite: (path) => path.replace(new RegExp(`^/basic-api`), ''),
  26. // only https
  27. // secure: false
  28. },
  29. '/upload': {
  30. target: 'http://localhost:3300/upload',
  31. changeOrigin: true,
  32. ws: true,
  33. rewrite: (path) => path.replace(new RegExp(`^/upload`), ''),
  34. },
  35. },
  36. open: true, // 项目启动后,自动打开
  37. warmup: {
  38. clientFiles: ['./index.html', './src/{views,components}/*'],
  39. },
  40. },
  41. plugins: [
  42. Inspector({
  43. openInEditorHost: 'http://localhost:5173',
  44. }),
  45. ],
  46. },
  47. });