vite.config.ts 1.5 KB

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