// vite.config.ts
import { defineConfig } from 'vite'
export default defineConfig({
build: {
outDir: '../dist', // Output directory
emptyOutDir: true, // Clean before build
sourcemap: false, // Disable source maps in production
minify: 'esbuild', // Minification method
target: 'es2015', // Browser target
rollupOptions: {
output: {
// Code splitting
manualChunks: {
'react-vendor': ['react', 'react-dom'],
'router': ['react-router-dom'],
},
// Asset naming with hashes
entryFileNames: 'assets/[name].[hash].js',
chunkFileNames: 'assets/[name].[hash].js',
assetFileNames: 'assets/[name].[hash].[ext]',
},
},
// Size warning threshold
chunkSizeWarningLimit: 1000, // 1000 KB
},
})