-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.mts
More file actions
102 lines (101 loc) · 2.79 KB
/
vite.config.mts
File metadata and controls
102 lines (101 loc) · 2.79 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import terser from "@rollup/plugin-terser";
import react from "@vitejs/plugin-react-swc";
import path from "path";
import { defineConfig, splitVendorChunkPlugin } from "vite";
import { compression as viteCompression } from "vite-plugin-compression2";
import svgr from "vite-plugin-svgr";
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: {
"@components": path.resolve(__dirname, "./src/components"),
"@store": path.resolve(__dirname, "./src/store"),
"@lib": path.resolve(__dirname, "./src/lib"),
"@utils": path.resolve(__dirname, "./src/utils"),
"@style": path.resolve(__dirname, "./src/styles"),
"@icons": path.resolve(__dirname, "./src/assets"),
"@hooks": path.resolve(__dirname, "./src/hooks"),
"@constants": path.resolve(__dirname, "./src/constants"),
"@api": path.resolve(__dirname, "./src/api"),
},
},
server: {
port: 2222,
},
preview: {
port: 2222,
},
plugins: [
svgr(),
react(),
terser(),
splitVendorChunkPlugin(),
viteCompression({
algorithm: "brotliCompress",
exclude: [/\.(br)$/, /\.(gz)$/],
}),
],
build: {
chunkSizeWarningLimit: 550,
minify: "terser",
sourcemap: false,
cssCodeSplit: true,
emptyOutDir: true,
rollupOptions: {
output: {
manualChunks(id: string) {
if (id.includes("clsx")) {
return "@clsx";
}
if (id.includes("resize-observer-polyfill")) {
return "@resize-observer-polyfill";
}
if (id.includes("crypto-js")) {
return "@crypto-js";
}
if (id.includes("styled-components")) {
return "@styled-components";
}
if (id.includes("tailwindcss")) {
return "@tailwindcss";
}
if (id.includes("postcss")) {
return "@postcss";
}
if (id.includes("notistack")) {
return "@notistack";
}
if (id.includes("preline")) {
return "@preline";
}
if (id.includes("tailwind-merge")) {
return "@tailwind-merge";
}
if (id.includes("zustand")) {
return "@zustand";
}
if (id.includes("react-hook-form")) {
return "@react-hook-form";
}
if (id.includes("axios")) {
return "@axios";
}
if (id.includes("swr")) {
return "@swr";
}
if (
id.includes("react-router-dom") ||
id.includes("@remix-run") ||
id.includes("react-router")
) {
return "@react-router";
}
},
globals: {
react: "React",
"react-dom": "ReactDOM",
},
},
},
},
});