-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
46 lines (43 loc) · 1.18 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
import path from 'path';
import react from '@vitejs/plugin-react';
import { visualizer } from 'rollup-plugin-visualizer';
import { defineConfig, type PluginOption } from 'vite';
const plugins: PluginOption[] = [react()];
if (process.env.ROLLUP_CHUNKS) {
plugins.push(
visualizer({
template: 'treemap',
open: true, // Open browser after generation
gzipSize: true,
brotliSize: true,
filename: 'chunks.html'
})
);
}
// https://vitejs.dev/config/
export default defineConfig({
plugins,
resolve: {
alias: { '@': path.resolve(__dirname, './src') }
},
build: {
rollupOptions: {
output: {
manualChunks: {
redux: ['@reduxjs/toolkit'],
react: ['react', 'react-dom'],
form: ['react-hook-form', 'zod'],
utils: ['tailwind-merge', 'dayjs'],
common: ['axios', 'react-helmet-async', '@tanstack/react-query'],
router: ['react-router', 'react-router-dom'],
radixHeavy: [
'@radix-ui/react-toast',
'@radix-ui/react-tooltip',
'@radix-ui/react-scroll-area',
'@radix-ui/react-context-menu'
]
}
}
}
}
});