vite.config.ts 1.2 KB

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