-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathvite.config.ts
More file actions
80 lines (70 loc) · 2.04 KB
/
vite.config.ts
File metadata and controls
80 lines (70 loc) · 2.04 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import tailwindcss from '@tailwindcss/vite';
import path from 'path';
export default defineConfig(({ mode }) => {
const isProduction = mode === 'production' || mode === 'pages';
const isPages = mode === 'pages';
return {
base: isPages ? '/meta-human/' : '/',
css: {
transformer: 'lightningcss',
lightningcss: {
targets: {
chrome: 105 << 16,
safari: 16 << 16,
ios_saf: 16 << 16,
firefox: 105 << 16,
},
},
},
plugins: [
react({
jsxImportSource: 'react',
removeConsole: isProduction,
}),
tailwindcss(),
].filter(Boolean),
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
build: {
outDir: 'dist',
sourcemap: false,
cssCodeSplit: true,
cssMinify: 'lightningcss',
assetsInlineLimit: 5120,
emptyOutDir: true,
chunkSizeWarningLimit: 1500,
target: 'es2020',
minify: 'esbuild',
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('node_modules')) {
if (/[\\/]node_modules[\\/](react|react-dom)[\\/]/.test(id)) return 'react-vendor';
if (/[\\/]node_modules[\\/](three|@react-three)[\\/]/.test(id)) return 'three-vendor';
if (/[\\/]node_modules[\\/]zustand[\\/]/.test(id)) return 'state-vendor';
if (/[\\/]node_modules[\\/](lucide-react|sonner|clsx|tailwind-merge)[\\/]/.test(id)) return 'ui-vendor';
if (/[\\/]node_modules[\\/]react-router-dom[\\/]/.test(id)) return 'router-vendor';
}
},
entryFileNames: 'assets/[name]-[hash].js',
chunkFileNames: 'assets/[name]-[hash].js',
assetFileNames: 'assets/[name]-[hash][extname]',
},
},
},
server: {
host: '0.0.0.0',
port: 5173,
open: true,
},
preview: {
host: '0.0.0.0',
port: 4173,
},
};
});