-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
36 lines (35 loc) · 1.19 KB
/
vite.config.ts
File metadata and controls
36 lines (35 loc) · 1.19 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
import { defineConfig } from "vite";
import tsConfigPaths from "vite-tsconfig-paths";
import { cloudflare } from "@cloudflare/vite-plugin";
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
import viteReact from "@vitejs/plugin-react";
export default defineConfig({
server: {
port: 3000,
},
build: {
rollupOptions: {
external: ["cloudflare:workers"],
},
},
resolve: {
alias: {
// React 19 includes useSyncExternalStore natively. These aliases
// redirect shim imports to the real package for compatibility with
// libraries that haven't fully dropped the shim yet.
"use-sync-external-store/shim/index.js": "use-sync-external-store",
"use-sync-external-store/shim/with-selector.js": "use-sync-external-store",
},
},
// Required: TanStack Start uses virtual modules (#tanstack-router-entry, #tanstack-start-entry)
// that break Vite's dep optimizer. Excluding these packages prevents pre-bundling errors.
optimizeDeps: {
exclude: ["@tanstack/react-start", "@tanstack/start-server-core"],
},
plugins: [
tsConfigPaths(),
cloudflare({ viteEnvironment: { name: "ssr" } }),
tanstackStart(),
viteReact(),
],
});