-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.js
47 lines (45 loc) · 1.33 KB
/
vite.config.js
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import { resolve } from 'path'
import { fileURLToPath } from 'url'
const __dirname = fileURLToPath(new URL('.', import.meta.url))
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
tailwindcss(),
],
build: {
sourcemap: false, // Disable sourcemaps in production for smaller files
minify: 'terser', // Use terser for better minification
cssMinify: true,
terserOptions: {
compress: {
drop_console: true, // Remove console logs in production
drop_debugger: true
}
},
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
},
output: {
manualChunks: {
'react-vendor': ['react', 'react-dom', 'react-router-dom'],
'three-vendor': ['three', '@react-three/fiber', '@react-three/drei', '@react-three/postprocessing'],
'framer-motion': ['framer-motion']
},
assetFileNames: (assetInfo) => {
if (assetInfo.name.endsWith('.ico')) {
return '[name][extname]';
}
return 'assets/[name]-[hash][extname]';
}
}
}
},
optimizeDeps: {
include: ['react', 'react-dom', 'react-router-dom', 'framer-motion']
}
})