-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
53 lines (51 loc) · 1.35 KB
/
vite.config.ts
File metadata and controls
53 lines (51 loc) · 1.35 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
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react-swc";
// Pull version from package.json so the UI can display it consistently.
const packageJson = JSON.parse(
fs.readFileSync(new URL("./package.json", import.meta.url), "utf-8")
) as { version?: string };
const host = process.env.TAURI_DEV_HOST;
const rootDir = fileURLToPath(new URL(".", import.meta.url));
export default defineConfig({
plugins: [react()],
base: "./",
clearScreen: false,
server: {
port: 1419,
strictPort: true,
host: host || false,
hmr: host
? {
protocol: "ws",
host,
port: 1421
}
: undefined,
watch: {
ignored: ["**/src-tauri/**"]
}
},
envPrefix: ["VITE_", "TAURI_ENV_"],
build: {
target:
process.env.TAURI_ENV_PLATFORM === "windows" ? "chrome105" : "safari13",
minify: process.env.TAURI_ENV_DEBUG ? false : "esbuild",
sourcemap: !!process.env.TAURI_ENV_DEBUG
},
resolve: {
alias: {
"@": path.resolve(rootDir, "src")
}
},
define: {
__APP_VERSION__: JSON.stringify(packageJson.version ?? "0.0.0")
},
test: {
environment: "node",
include: ["src/**/*.test.ts"],
exclude: ["node_modules", "dist", "src-tauri"]
}
});