-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathvite.config.ts
More file actions
68 lines (66 loc) · 1.79 KB
/
vite.config.ts
File metadata and controls
68 lines (66 loc) · 1.79 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
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
// Convert Convex cloud URL to HTTP site URL
const convexUrl = env.VITE_CONVEX_URL || "";
const convexSiteUrl = convexUrl.replace(".cloud", ".site");
return {
plugins: [react()],
build: {
outDir: "dist",
rollupOptions: {
output: {
manualChunks: {
// Vendor chunks for better caching
"vendor-react": ["react", "react-dom", "react-router-dom"],
"vendor-convex": ["convex", "convex/react"],
"vendor-markdown": [
"react-markdown",
"remark-gfm",
"remark-breaks",
"rehype-raw",
"rehype-sanitize",
],
"vendor-syntax": ["react-syntax-highlighter"],
"vendor-diffs": ["@pierre/diffs"],
},
},
},
},
server: {
proxy: {
// Proxy RSS and sitemap to Convex HTTP endpoints in development
"/rss.xml": {
target: convexSiteUrl,
changeOrigin: true,
},
"/rss-full.xml": {
target: convexSiteUrl,
changeOrigin: true,
},
"/sitemap.xml": {
target: convexSiteUrl,
changeOrigin: true,
},
"/api/posts": {
target: convexSiteUrl,
changeOrigin: true,
},
"/api/post": {
target: convexSiteUrl,
changeOrigin: true,
},
"/meta/post": {
target: convexSiteUrl,
changeOrigin: true,
},
"/raw/": {
target: convexSiteUrl,
changeOrigin: true,
},
},
},
};
});