forked from EVWorth/sqlpilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
51 lines (49 loc) · 1.37 KB
/
Copy pathvite.config.ts
File metadata and controls
51 lines (49 loc) · 1.37 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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { readFileSync } from "fs";
import { resolve } from "path";
const host = process.env.TAURI_DEV_HOST;
const pkg = JSON.parse(readFileSync(resolve(__dirname, "package.json"), "utf-8"));
export default defineConfig(async () => ({
plugins: [react()],
define: {
"import.meta.env.VITE_APP_VERSION": JSON.stringify(pkg.version),
},
clearScreen: false,
server: {
port: 1420,
strictPort: true,
host: host || false,
hmr: host
? {
protocol: "ws",
host,
port: 1421,
}
: undefined,
watch: {
ignored: ["**/src-tauri/**"],
},
},
build: {
sourcemap: process.env.NODE_ENV === "development",
minify: "terser",
terserOptions: {
compress: {
drop_console: true,
},
},
rollupOptions: {
output: {
manualChunks(id: string) {
if (id.includes("monaco-editor") || id.includes("@monaco-editor/react")) return "monaco";
if (id.includes("@tanstack/react-table") || id.includes("@tanstack/react-virtual")) return "tanstack";
if (id.includes("lucide-react")) return "lucide";
},
// Generate smaller chunks for better parallelism
chunkFileNames: "chunks/[name].[hash].js",
entryFileNames: "[name].[hash].js",
},
},
},
}));