-
Notifications
You must be signed in to change notification settings - Fork 3
/
vite.config.ts
executable file
·78 lines (76 loc) · 2.19 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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import dotenv from "dotenv";
dotenv.config({ path: "../.env" });
export default defineConfig({
plugins: [react()],
define: {
"import.meta.env": Object.fromEntries(Object.entries(process.env).map(([key, value]) => [`VITE_${key}`, value]))
},
resolve: {
alias: {
"react-textfit": "@namhong2001/react-textfit",
"@brender": "/src/brender",
"@components": "/src/components",
"@controllers": "/src/controllers",
"@functions": "/src/functions",
"@stores": "/src/stores"
},
preserveSymlinks: true
},
server: {
proxy: {
"/api": {
target: process.env.VITE_BACKEND_URL,
changeOrigin: true,
ws: true
},
"/gateway": {
target: process.env.VITE_BACKEND_URL,
changeOrigin: true,
ws: true
}
}
},
css: {
modules: {
scopeBehaviour: "local",
localsConvention: "camelCaseOnly",
generateScopedName: "[name]__[local]___[hash:base64:5]"
}
},
build: {
target: "es2022",
outDir: "./dist",
rollupOptions: {
output: {
manualChunks: (id: string) => {
if (id.includes("node_modules")) return "vendor";
return "main";
},
chunkFileNames: "[name].[hash].js",
entryFileNames: "[name].[hash].js",
assetFileNames: "[name].[hash].[ext]"
}
},
chunkSizeWarningLimit: 1000,
manifest: true,
minify: "terser",
terserOptions: {
format: {
comments: false
},
compress: {
sequences: true,
booleans: true,
loops: true,
toplevel: true,
unsafe: true,
drop_console: true,
unsafe_comps: true,
passes: 2
},
module: true
}
}
});