2025-12-12 15:02:56 -08:00
|
|
|
import { defineConfig } from 'vite';
|
|
|
|
|
import react from '@vitejs/plugin-react';
|
|
|
|
|
import path from 'path';
|
|
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
plugins: [react()],
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
'@': path.resolve(__dirname, './src'),
|
|
|
|
|
'@/components': path.resolve(__dirname, './src/components'),
|
|
|
|
|
'@/pages': path.resolve(__dirname, './src/pages'),
|
|
|
|
|
'@/services': path.resolve(__dirname, './src/services'),
|
|
|
|
|
'@/hooks': path.resolve(__dirname, './src/hooks'),
|
|
|
|
|
'@/utils': path.resolve(__dirname, './src/utils'),
|
|
|
|
|
'@/types': path.resolve(__dirname, './src/types'),
|
|
|
|
|
'@/constants': path.resolve(__dirname, './src/constants'),
|
2026-01-02 20:27:42 -08:00
|
|
|
'@/config': path.resolve(__dirname, './src/config'),
|
2025-12-12 15:02:56 -08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
server: {
|
|
|
|
|
port: 3001,
|
|
|
|
|
proxy: {
|
|
|
|
|
'/api': {
|
|
|
|
|
target: 'http://localhost:3000',
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-01-02 20:27:42 -08:00
|
|
|
build: {
|
|
|
|
|
// Optimize build output
|
|
|
|
|
target: 'esnext',
|
|
|
|
|
minify: 'esbuild',
|
|
|
|
|
sourcemap: false, // Set to true for production debugging if needed
|
|
|
|
|
rollupOptions: {
|
|
|
|
|
output: {
|
|
|
|
|
// Manual code splitting for better caching
|
|
|
|
|
manualChunks: {
|
|
|
|
|
// Vendor chunks
|
|
|
|
|
'react-vendor': ['react', 'react-dom', 'react-router-dom'],
|
|
|
|
|
'query-vendor': ['@tanstack/react-query'],
|
|
|
|
|
'ui-vendor': ['recharts', 'react-icons', 'react-hot-toast'],
|
|
|
|
|
'utils-vendor': ['axios', 'zod', 'date-fns', 'clsx', 'zustand'],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
// Chunk size warning limit (1MB)
|
|
|
|
|
chunkSizeWarningLimit: 1000,
|
|
|
|
|
},
|
|
|
|
|
// Optimize dependencies
|
|
|
|
|
optimizeDeps: {
|
|
|
|
|
include: ['react', 'react-dom', 'react-router-dom', '@tanstack/react-query'],
|
|
|
|
|
},
|
2025-12-12 15:02:56 -08:00
|
|
|
});
|
|
|
|
|
|