vite.config.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. console.log(env.mode)
  10. return {
  11. plugins: [vue(), vueJsx(), tailwindcss()],
  12. resolve: {
  13. alias: {
  14. '@': fileURLToPath(new URL('./src', import.meta.url)),
  15. },
  16. },
  17. server: {
  18. port: 5799,
  19. },
  20. build: {
  21. rollupOptions: {
  22. output: {
  23. advancedChunks: {
  24. groups: [
  25. {
  26. name: 'echarts',
  27. test: /\/echarts/,
  28. },
  29. {
  30. name: 'chroma-js',
  31. test: /\/chroma-js/,
  32. },
  33. {
  34. name: 'lodash-es',
  35. test: /\/lodash-es/,
  36. },
  37. ],
  38. },
  39. assetFileNames: (info) => {
  40. const notHash = ['topography.svg', 'texture.png', 'noise.png']
  41. if (notHash.includes(info.names[0])) {
  42. return 'assets/[name][extname]'
  43. }
  44. return 'assets/[name]-[hash][extname]'
  45. },
  46. },
  47. },
  48. },
  49. esbuild: {
  50. drop: env.mode === 'production' ? ['console', 'debugger'] : [],
  51. },
  52. }
  53. })