-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
58 lines (55 loc) · 1.59 KB
/
Copy pathvite.config.ts
File metadata and controls
58 lines (55 loc) · 1.59 KB
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
48
49
50
51
52
53
54
55
56
57
58
import path from 'node:path'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
// https://vite.dev/config/
export default defineConfig({
plugins: [react({
babel: {
plugins: [
'babel-plugin-react-compiler',
],
},
}), tailwindcss()],
resolve: {
alias: {
'@components': path.resolve(process.cwd(), 'src/components'),
'@hooks': path.resolve(process.cwd(), 'src/hooks'),
'@context': path.resolve(process.cwd(), 'src/context'),
'@providers': path.resolve(process.cwd(), 'src/providers'),
'@types': path.resolve(process.cwd(), 'src/types'),
'@utils': path.resolve(process.cwd(), 'src/utils'),
},
},
// Dev performance: pre-bundle and warm up
optimizeDeps: {
include: ['react', 'react-dom', 'clsx', 'tailwind-merge'],
},
server: {
warmup: {
clientFiles: ['./src/main.tsx', './src/App.tsx', './src/components/ShoppingApp/Root.tsx'],
},
},
// Build performance and output
build: {
target: 'esnext',
minify: 'esbuild',
reportCompressedSize: false,
sourcemap: false,
rollupOptions: {
output: {
chunkFileNames: 'assets/[name]-[hash].js',
entryFileNames: 'assets/[name]-[hash].js',
assetFileNames: 'assets/[name]-[hash][extname]',
manualChunks: (id) => {
if (id.includes('node_modules')) {
if (id.includes('react-dom') || id.includes('react/')) {
return 'vendor-react'
}
return 'vendor'
}
},
},
},
},
})