vite.config.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. // https://vitejs.dev/config/
  4. export default defineConfig(({ mode }) => {
  5. return {
  6. base: mode === 'production' ? '/' : '/',
  7. server: {
  8. host: '0.0.0.0',
  9. port: 9527,
  10. proxy: {
  11. '/api': {
  12. target: 'http://zohocrm.promocollection.com.au:9007/',
  13. changeOrigin: true,
  14. rewrite: (path) => path.replace(/^\/api/, ''),
  15. },
  16. '/bpi': {
  17. // target: 'http://api.promocollection.com.cn:9004',
  18. target: 'http://192.168.40.5:8099',
  19. changeOrigin: true,
  20. rewrite: (path) => path.replace(/^\/bpi/, ''),
  21. },
  22. },
  23. },
  24. resolve: {
  25. alias: {
  26. '@': '/src/',
  27. },
  28. },
  29. css: {
  30. devSourcemap: true,
  31. preprocessorOptions: {
  32. scss: {
  33. api: 'modern',
  34. additionalData: `@use '@/assets/css/var.scss' as *;`,
  35. },
  36. },
  37. },
  38. plugins: [vue({ template: { compilerOptions: { hoistStatic: false } } })],
  39. build: {
  40. // 设置最终构建的浏览器兼容目标
  41. target: 'es2020',
  42. // 构建后是否生成 source map 文件
  43. sourcemap: false,
  44. // chunk 大小警告的限制(以 kbs 为单位)
  45. chunkSizeWarningLimit: 1000,
  46. // 启用/禁用 gzip 压缩大小报告
  47. reportCompressedSize: false,
  48. },
  49. }
  50. })