-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
32 lines (31 loc) · 952 Bytes
/
vite.config.js
File metadata and controls
32 lines (31 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
assetsInclude: ['**/*.JPG', '**/*.jpg', '**/*.PNG', '**/*.png'],
build: {
// Optimize asset handling
assetsInlineLimit: 4096, // Inline assets smaller than 4kb
rollupOptions: {
output: {
// Optimize chunk splitting for better caching
manualChunks: {
'react-vendor': ['react', 'react-dom'],
},
// Optimize asset file names
assetFileNames: (assetInfo) => {
const info = assetInfo.name.split('.');
const ext = info[info.length - 1];
if (/png|jpe?g|svg|gif|tiff|bmp|ico/i.test(ext)) {
return `images/[name]-[hash][extname]`;
}
return `assets/[name]-[hash][extname]`;
},
},
},
},
// Optimize dependencies
optimizeDeps: {
include: ['react', 'react-dom'],
},
});