-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
54 lines (50 loc) · 1.49 KB
/
vite.config.ts
File metadata and controls
54 lines (50 loc) · 1.49 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
/// <reference types="vitest/config" />
import { defineConfig } from "vite";
import type { UserConfigFnObject } from "vite";
import react from "@vitejs/plugin-react";
import svgr from "vite-plugin-svgr";
import llmsTxtPlugin from "./plugins/vite-plugin-llms-txt";
// https://vite.dev/config/
const config: ReturnType<typeof defineConfig> = defineConfig((({ mode }) => {
const siteUrl =
process.env["SITE_URL"] ??
(mode === "development" ? "http://localhost:5173" : null);
if (null === siteUrl) {
throw new Error(
"SITE_URL environment variable is required for production builds. " +
"Set it in your build command or CI/CD workflow.",
);
}
return {
// NOTE: THIS PATH MUST END WITH A TRAILING SLASH
base: process.env["BASE_PUBLIC_PATH"] ?? "/",
plugins: [
react(),
svgr(),
llmsTxtPlugin({
siteUrl,
}),
],
build: {
assetsInlineLimit(filePath: string) {
// Never inline model/data/notebook assets — they need stable URLs
// for DuckDB file registration and download links
if (filePath.includes("/models/")) return false;
// Everything else uses the default 4 KiB threshold
return undefined;
},
},
define: {
"process.env": {},
},
optimizeDeps: {
esbuildOptions: {
target: "esnext",
},
},
test: {
include: ["tests/**/*.test.ts", "tests/**/*.test.tsx"],
},
};
}) satisfies UserConfigFnObject);
export default config;