vite.config.ts 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import { fileURLToPath, URL } from 'node:url'
  2. import tailwindcss from '@tailwindcss/vite'
  3. import basicSsl from '@vitejs/plugin-basic-ssl'
  4. import vue from '@vitejs/plugin-vue'
  5. import vueJsx from '@vitejs/plugin-vue-jsx'
  6. import { defineConfig } from 'vite'
  7. // import vueDevTools from 'vite-plugin-vue-devtools'
  8. // https://vite.dev/config/
  9. export default defineConfig((env) => {
  10. return {
  11. plugins: [vue(), vueJsx(), tailwindcss(), basicSsl()],
  12. resolve: {
  13. alias: {
  14. '@': fileURLToPath(new URL('./src', import.meta.url)),
  15. },
  16. },
  17. server: {
  18. port: 5799,
  19. host: true,
  20. },
  21. build: {
  22. rollupOptions: {
  23. output: {
  24. advancedChunks: {
  25. groups: [
  26. {
  27. name: 'echarts',
  28. test: /\/echarts/,
  29. },
  30. {
  31. name: 'chroma-js',
  32. test: /\/chroma-js/,
  33. },
  34. {
  35. name: 'lodash-es',
  36. test: /\/lodash-es/,
  37. },
  38. {
  39. name: 'naive-ui',
  40. test: /\/naive-ui/,
  41. },
  42. {
  43. name: 'vue-draggable-plus',
  44. test: /\/vue-draggable-plus/,
  45. },
  46. {
  47. name: 'vueuse',
  48. test: /\/vueuse/,
  49. },
  50. {
  51. name: 'vue',
  52. test: /\/vue/,
  53. },
  54. {
  55. name: 'vue-router',
  56. test: /\/vue-router/,
  57. },
  58. {
  59. name: 'pinia',
  60. test: /\/pinia/,
  61. },
  62. ],
  63. },
  64. assetFileNames: (info) => {
  65. const notHash = ['topography.svg', 'texture.png', 'noise.png']
  66. if (notHash.includes(info.names[0])) {
  67. return 'assets/[name][extname]'
  68. }
  69. return 'assets/[name]-[hash][extname]'
  70. },
  71. },
  72. },
  73. },
  74. esbuild: {
  75. drop: env.mode === 'production' ? ['console', 'debugger'] : [],
  76. },
  77. }
  78. })