Cleaning the codebase
This commit is contained in:
@ -4,4 +4,41 @@ import react from '@vitejs/plugin-react'
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
build: {
|
||||
// Generate source maps for production debugging
|
||||
sourcemap: false,
|
||||
// Optimize chunk size threshold
|
||||
chunkSizeWarningLimit: 1000,
|
||||
// Enable minification (use default for rolldown)
|
||||
minify: true,
|
||||
// Rollup options for advanced bundling
|
||||
rollupOptions: {
|
||||
output: {
|
||||
// Manual chunk splitting for better caching
|
||||
manualChunks: (id) => {
|
||||
if (id.includes('react') || id.includes('react-dom')) {
|
||||
return 'react'
|
||||
}
|
||||
if (id.includes('nanostores')) {
|
||||
return 'stores'
|
||||
}
|
||||
if (id.includes('jszip') || id.includes('geopattern')) {
|
||||
return 'vendor'
|
||||
}
|
||||
},
|
||||
// Optimize chunk file names
|
||||
chunkFileNames: 'assets/[name]-[hash].js',
|
||||
entryFileNames: 'assets/[name]-[hash].js',
|
||||
assetFileNames: 'assets/[name]-[hash].[ext]',
|
||||
},
|
||||
},
|
||||
// Target modern browsers for better optimization
|
||||
target: 'esnext',
|
||||
// Enable CSS code splitting
|
||||
cssCodeSplit: true,
|
||||
},
|
||||
// Optimize dependency pre-bundling
|
||||
optimizeDeps: {
|
||||
include: ['react', 'react-dom', 'nanostores', '@nanostores/react'],
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user