vite.config.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. ],
  16. },
  17. server: {
  18. proxy: {
  19. '/basic-api': {
  20. target: 'http://localhost:3000',
  21. changeOrigin: true,
  22. ws: true,
  23. rewrite: (path) => path.replace(new RegExp(`^/basic-api`), ''),
  24. // only https
  25. // secure: false
  26. },
  27. '/upload': {
  28. target: 'http://localhost:3300/upload',
  29. changeOrigin: true,
  30. ws: true,
  31. rewrite: (path) => path.replace(new RegExp(`^/upload`), ''),
  32. },
  33. },
  34. open: true, // 项目启动后,自动打开
  35. warmup: {
  36. clientFiles: ['./index.html', './src/{views,components}/*'],
  37. },
  38. },
  39. plugins: [
  40. Inspector({
  41. openInEditorHost: 'http://localhost:5173',
  42. }),
  43. ],
  44. },
  45. });