vite.config.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { fileURLToPath, URL } from 'node:url'
  2. import tailwindcss from '@tailwindcss/vite'
  3. import vue from '@vitejs/plugin-vue'
  4. import vueJsx from '@vitejs/plugin-vue-jsx'
  5. import { defineConfig } from 'vite'
  6. // import vueDevTools from 'vite-plugin-vue-devtools'
  7. // https://vite.dev/config/
  8. export default defineConfig((env) => {
  9. return {
  10. plugins: [vue(), vueJsx(), tailwindcss()],
  11. resolve: {
  12. alias: {
  13. '@': fileURLToPath(new URL('./src', import.meta.url)),
  14. },
  15. },
  16. server: {
  17. port: 5799,
  18. },
  19. build: {
  20. rollupOptions: {
  21. output: {
  22. advancedChunks: {
  23. groups: [
  24. {
  25. name: 'echarts',
  26. test: /\/echarts/,
  27. },
  28. {
  29. name: 'chroma-js',
  30. test: /\/chroma-js/,
  31. },
  32. {
  33. name: 'lodash-es',
  34. test: /\/lodash-es/,
  35. },
  36. ],
  37. },
  38. assetFileNames: (info) => {
  39. const notHash = ['topography.svg', 'texture.png', 'noise.png']
  40. if (notHash.includes(info.names[0])) {
  41. return 'assets/[name][extname]'
  42. }
  43. return 'assets/[name]-[hash][extname]'
  44. },
  45. },
  46. },
  47. },
  48. esbuild: {
  49. drop: env.mode === 'production' ? ['console', 'debugger'] : [],
  50. },
  51. }
  52. })