-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathvite.config.ts
93 lines (85 loc) · 2.47 KB
/
vite.config.ts
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import react from '@vitejs/plugin-react';
import autoprefixer from 'autoprefixer';
import path from 'path';
import tailwindcss from 'tailwindcss';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [
react({
babel: {
plugins: [['babel-plugin-react-compiler', {}]],
},
}),
],
css: {
postcss: {
plugins: [tailwindcss, autoprefixer],
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
build: {
target: 'es2020',
sourcemap: true,
rollupOptions: {
output: {
manualChunks: {
// group react dependencies together
'vendor-react': ['react', 'react-dom', 'react-router-dom'],
// group radix ui components
'vendor-radix': [
'@radix-ui/react-accordion',
'@radix-ui/react-avatar',
'@radix-ui/react-dialog',
'@radix-ui/react-dropdown-menu',
'@radix-ui/react-label',
'@radix-ui/react-popover',
'@radix-ui/react-scroll-area',
'@radix-ui/react-slot',
'@radix-ui/react-tabs',
'@radix-ui/react-toggle',
'@radix-ui/react-toggle-group',
'@radix-ui/react-tooltip',
],
// group form-related dependencies
'vendor-form': ['react-hook-form', '@hookform/resolvers', 'zod'],
// group utility libraries
'vendor-utils': [
'class-variance-authority',
'clsx',
'tailwind-merge',
'zustand',
],
// group blueprint stuffs
'vendor-blueprint': ['pako'],
// group supabase stuffs
'vendor-supabase': ['@supabase/supabase-js'],
// group markdown stuffs
'vendor-markdown': ['@uiw/react-md-editor'],
// group image stuffs
'vendor-image': ['browser-image-compression'],
},
chunkFileNames: 'assets/js/[name]-[hash].js',
entryFileNames: 'assets/js/[name]-[hash].js',
assetFileNames: 'assets/[ext]/[name]-[hash].[ext]',
// minimize property names
compact: true,
},
},
// enable minification optimizations
minify: 'terser',
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
},
},
// reduce chunk size warnings threshold
chunkSizeWarningLimit: 1000,
// enable build-time optimizations
reportCompressedSize: true,
},
});