-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathvite.config.mts
54 lines (51 loc) · 1.22 KB
/
vite.config.mts
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
import { TanStackRouterVite } from "@tanstack/router-vite-plugin";
import react from "@vitejs/plugin-react";
import Icons from "unplugin-icons/vite";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
import cp from "node:child_process";
const commitHash = cp.execSync("git rev-parse --short HEAD").toString().replace("\n", "");
export default defineConfig(({ mode: _ }) => {
return {
plugins: [
TanStackRouterVite({
quoteStyle: "double",
}),
react(),
tsconfigPaths({
projects: ["./tsconfig.json"],
}),
Icons({
compiler: "jsx",
jsx: "react",
iconCustomizer(_1, _2, props) {
props.width = "1.5rem";
props.height = "1.5rem";
},
}),
],
server: {
proxy: {
"/api": {
target: "http://localhost:5000",
ws: true,
},
},
},
build: {
minify: "terser",
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
},
format: {
comments: false,
},
},
},
define: {
"import.meta.env.UI_VERSION": JSON.stringify(commitHash),
},
};
});