vite.config.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. base: '/foreground/',
  12. plugins: [vue(), vueJsx(), tailwindcss(), basicSsl()],
  13. resolve: {
  14. alias: {
  15. '@': fileURLToPath(new URL('./src', import.meta.url)),
  16. },
  17. },
  18. server: {
  19. port: 5799,
  20. host: true,
  21. },
  22. build: {
  23. rollupOptions: {
  24. output: {
  25. advancedChunks: {
  26. groups: [
  27. {
  28. name: 'echarts',
  29. test: /\/echarts/,
  30. },
  31. {
  32. name: 'chroma-js',
  33. test: /\/chroma-js/,
  34. },
  35. {
  36. name: 'lodash-es',
  37. test: /\/lodash-es/,
  38. },
  39. {
  40. name: 'naive-ui',
  41. test: /\/naive-ui/,
  42. },
  43. {
  44. name: 'vue-draggable-plus',
  45. test: /\/vue-draggable-plus/,
  46. },
  47. {
  48. name: 'vueuse',
  49. test: /\/vueuse/,
  50. },
  51. {
  52. name: 'vue',
  53. test: /\/vue/,
  54. },
  55. {
  56. name: 'vue-router',
  57. test: /\/vue-router/,
  58. },
  59. {
  60. name: 'pinia',
  61. test: /\/pinia/,
  62. },
  63. ],
  64. },
  65. assetFileNames: (info) => {
  66. const notHash = ['topography.svg', 'texture.png', 'noise.png']
  67. if (notHash.includes(info.names[0])) {
  68. return 'assets/[name][extname]'
  69. }
  70. return 'assets/[name]-[hash][extname]'
  71. },
  72. },
  73. },
  74. },
  75. optimizeDeps: {
  76. exclude: ['omnimatrix-video-player'],
  77. },
  78. esbuild: {
  79. drop: env.mode === 'production' ? ['console', 'debugger'] : [],
  80. },
  81. }
  82. })