vite.config.js 954 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { fileURLToPath, URL } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. export default defineConfig(({ mode }) => {
  5. const isProd = mode === 'production'
  6. return {
  7. base: '/',
  8. plugins: [vue()],
  9. resolve: {
  10. alias: {
  11. '@': fileURLToPath(new URL('./src', import.meta.url)),
  12. },
  13. },
  14. server: {
  15. host: '0.0.0.0',
  16. port: 7100,
  17. strictPort: true,
  18. proxy: {
  19. '/api': {
  20. target: process.env.VITE_API_TARGET || 'http://localhost:8080',
  21. changeOrigin: true,
  22. },
  23. },
  24. },
  25. build: {
  26. target: 'es2015',
  27. sourcemap: false,
  28. outDir: 'dist',
  29. assetsDir: 'assets',
  30. rollupOptions: {
  31. output: {
  32. chunkFileNames: 'assets/[name]-[hash].js',
  33. manualChunks: {
  34. echarts: ['echarts'],
  35. vue: ['vue', 'vue-router'],
  36. },
  37. },
  38. },
  39. },
  40. }
  41. })