forked from jeremyosih/gitinspect
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
86 lines (82 loc) · 2.05 KB
/
vite.config.ts
File metadata and controls
86 lines (82 loc) · 2.05 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
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
import viteReact from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
import { nitro } from "nitro/vite";
import { fileURLToPath } from "node:url";
import { defineConfig, type PluginOption } from "vite-plus";
import { comlink } from "vite-plugin-comlink";
const fromRoot = (path: string) => fileURLToPath(new URL(path, import.meta.url));
const asPlugin = (plugin: unknown): PluginOption => plugin as PluginOption;
const isTest = process.env.NODE_ENV === "test" || process.env.VITEST === "true";
const appPlugins: PluginOption[] = [
asPlugin(comlink()),
asPlugin(nitro()),
asPlugin(tailwindcss()),
asPlugin(
tanstackStart({
importProtection: {
behavior: {
build: "mock",
},
mockAccess: "off",
},
}),
),
asPlugin(viteReact()),
];
const workerPlugins = () => [asPlugin(comlink())];
export default defineConfig({
optimizeDeps: {
include: [
"streamdown",
"@streamdown/cjk",
"@streamdown/code",
"@streamdown/math",
"@streamdown/mermaid",
"mermaid",
"dayjs",
"@braintree/sanitize-url",
],
},
plugins: isTest ? [] : appPlugins,
resolve: {
alias: [
{
find: "@/pi/agent/runtime-worker-client",
replacement: fromRoot("./src/agent/runtime-worker-client.ts"),
},
{ find: "@/test", replacement: fromRoot("./tests/lib") },
{ find: "@", replacement: fromRoot("./src") },
],
},
server: {
port: 3001,
},
staged: {
"*": ["vp lint", "vp fmt --write"],
},
fmt: {
ignorePatterns: ["**/routeTree.gen.ts"],
},
lint: {
plugins: ["typescript", "unicorn", "oxc"],
categories: {
correctness: "error",
},
rules: {},
env: {
builtin: true,
},
},
test: {
environment: "jsdom",
globals: true,
testTimeout: 30_000,
include: ["tests/**/*.test.ts", "tests/**/*.test.tsx"],
setupFiles: ["./tests/setup.ts"],
},
worker: {
format: "es",
plugins: workerPlugins,
},
});