-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
67 lines (66 loc) · 2.1 KB
/
Copy pathvite.config.ts
File metadata and controls
67 lines (66 loc) · 2.1 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
import tailwindcss from "@tailwindcss/vite";
import { reactRouter } from "@react-router/dev/vite";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
export default defineConfig({
plugins: [
tailwindcss(), // must come before reactRouter
reactRouter(),
tsconfigPaths(),
],
server: {
port: Number(process.env.PORT ?? 5174),
},
resolve: {
// Force a single React instance — prevents "Invalid hook call" when CJS
// packages (e.g. zustand, @base-ui internals) pull in a second copy.
dedupe: ["react", "react-dom", "react-dom/client"],
},
optimizeDeps: {
// Crawl all route entry points upfront so Vite discovers every dep in a
// single pass and never triggers a mid-session re-optimisation that would
// produce a second React chunk with a different ?v= hash.
entries: [
"app/root.tsx",
"app/routes/**/*.tsx",
"app/components/**/*.tsx",
],
// Pre-bundle every non-React dep that imports React internally.
// Explicitly EXCLUDE react/react-dom: letting Vite handle them as part of
// react-dom's own sub-graph is more stable than forcing a separate entry.
include: [
"react-router",
"zustand",
"zustand/react",
"zustand/middleware",
"@tanstack/react-query",
"react-hook-form",
"@hookform/resolvers/zod",
"zod",
"cmdk",
"react-markdown",
"remark-gfm",
"@base-ui/react/accordion",
"@base-ui/react/avatar",
"@base-ui/react/button",
"@base-ui/react/checkbox",
"@base-ui/react/dialog",
"@base-ui/react/input",
"@base-ui/react/menu",
"@base-ui/react/merge-props",
"@base-ui/react/popover",
"@base-ui/react/preview-card",
"@base-ui/react/progress",
"@base-ui/react/radio",
"@base-ui/react/radio-group",
"@base-ui/react/scroll-area",
"@base-ui/react/select",
"@base-ui/react/separator",
"@base-ui/react/slider",
"@base-ui/react/switch",
"@base-ui/react/tabs",
"@base-ui/react/tooltip",
"@base-ui/react/use-render",
],
},
});