-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvite.config.ts
More file actions
99 lines (93 loc) · 2.39 KB
/
Copy pathvite.config.ts
File metadata and controls
99 lines (93 loc) · 2.39 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
87
88
89
90
91
92
93
94
95
96
97
98
99
import path from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig, normalizePath } from "vite";
const projectRoot = path.dirname(fileURLToPath(import.meta.url));
import { viteStaticCopy } from "vite-plugin-static-copy";
// @ts-expect-error process is a nodejs global
const host = process.env.TAURI_DEV_HOST;
// https://vite.dev/config/
export default defineConfig(async () => ({
build: {
target: "es2024",
rollupOptions: {
input: {
index: path.resolve(projectRoot, "index.html"),
viewer: path.resolve(projectRoot, "viewer.html"),
},
},
},
esbuild: {
target: "es2024",
},
define: {
__BUILD_DATE__: JSON.stringify(new Date().toISOString().slice(0, 10)),
},
assetsInclude: ["**/LICENSE", "**/THIRD-PARTY-LICENSES-rust.md", "**/THIRD-PARTY-LICENSES-js.md"],
plugins: [
viteStaticCopy({
targets: [
{
src: normalizePath(path.resolve("node_modules/pdfjs-dist/cmaps/*")),
dest: "pdfjs/cmaps",
structured: false,
},
{
src: normalizePath(path.resolve("node_modules/pdfjs-dist/standard_fonts/*")),
dest: "pdfjs/standard_fonts",
structured: false,
},
],
}),
],
test: {
exclude: [
"**/node_modules/**",
"**/dist/**",
"mcp-server/**",
"**/.stryker-tmp/**",
".claude/worktrees/**",
],
coverage: {
provider: "v8",
reporter: ["text", "html"],
all: true,
include: ["src/**/*.ts"],
exclude: [
"src/main.ts",
"src/main-viewer.ts",
"src/note-editor.ts",
"src/cjk-radical-map.ts",
"src/vendor/**",
"src/**/*.test.ts",
"src/vite-env.d.ts",
],
thresholds: {
lines: 80,
functions: 90,
branches: 70,
statements: 80,
},
},
},
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
//
// 1. prevent Vite from obscuring rust errors
clearScreen: false,
// 2. tauri expects a fixed port, fail if that port is not available
server: {
port: 1420,
strictPort: true,
host: host || false,
hmr: host
? {
protocol: "ws",
host,
port: 1421,
}
: undefined,
watch: {
// 3. tell Vite to ignore watching `src-tauri`
ignored: ["**/src-tauri/**"],
},
},
}));