-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvite.config.ts
More file actions
107 lines (100 loc) · 2.5 KB
/
vite.config.ts
File metadata and controls
107 lines (100 loc) · 2.5 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
103
104
105
106
107
import { sentryVitePlugin } from "@sentry/vite-plugin";
import react from "@vitejs/plugin-react";
import path from "path";
import { visualizer } from "rollup-plugin-visualizer";
import { defineConfig, normalizePath } from "vite";
import { viteStaticCopy } from "vite-plugin-static-copy";
const host = process.env.TAURI_DEV_HOST;
const vendorManualChunks = {
react: ["react", "react-dom", "react-dom/client"],
reactRouter: ["react-router"],
radixUi: [
"@radix-ui/react-accordion",
"@radix-ui/react-context-menu",
"@radix-ui/react-dialog",
"@radix-ui/react-dropdown-menu",
"@radix-ui/react-label",
"@radix-ui/react-popover",
"@radix-ui/react-radio-group",
"@radix-ui/react-scroll-area",
"@radix-ui/react-separator",
"@radix-ui/react-slot",
"@radix-ui/react-tooltip",
],
miscUi: ["vaul", "tailwind-merge"],
};
export default defineConfig(async () => ({
plugins: [
react({
babel: {
plugins: [["babel-plugin-react-compiler", { target: "19" }]],
},
}),
sentryVitePlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: "bestcodes-official",
project: "codequill-react",
telemetry: false,
}),
viteStaticCopy({
targets: [
{
src: normalizePath(
path.resolve(__dirname, "node_modules/monaco-editor/min/vs"),
),
dest: ".",
},
],
}),
visualizer({
open: false,
emitFile: false,
filename: "dist/stats.html",
}),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
clearScreen: false,
server: {
port: 1420,
strictPort: true,
host: host || false,
hmr: host
? {
protocol: "ws",
host,
port: 1421,
}
: undefined,
watch: {
ignored: ["**/src-tauri/**"],
},
},
build: {
sourcemap: true,
rollupOptions: {
output: {
manualChunks(id: string) {
// Normalize to POSIX-style paths so checks work on Windows too
const normalizedId = id.replace(/\\/g, "/");
if (normalizedId.includes("/node_modules/")) {
for (const [chunkName, packages] of Object.entries(
vendorManualChunks,
)) {
if (
packages.some((pkg) =>
normalizedId.includes(`/node_modules/${pkg}/`),
)
) {
return chunkName;
}
}
}
},
},
},
},
}));