-
-
Notifications
You must be signed in to change notification settings - Fork 301
Expand file tree
/
Copy pathvite.config.ts
More file actions
54 lines (52 loc) · 1.4 KB
/
Copy pathvite.config.ts
File metadata and controls
54 lines (52 loc) · 1.4 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 { resolve } from "node:path";
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
import babel from "@rolldown/plugin-babel";
import { tanstackRouter } from "@tanstack/router-plugin/vite";
import { defineConfig } from "vite";
import * as os from "node:os";
const isDebug = !!process.env.TAURI_ENV_DEBUG;
const host = process.env.TAURI_DEV_HOST;
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
tanstackRouter({
target: "react",
}),
react(),
babel({
presets: [reactCompilerPreset()],
}),
],
server: {
port: 1420,
strictPort: true,
host: host || false,
hmr: host
? {
protocol: "ws",
host,
port: 1421,
}
: undefined,
watch: {
ignored: ["**/src-tauri/**"],
},
},
build: {
minify: isDebug ? false : "esbuild",
sourcemap: isDebug ? "inline" : false,
target: process.env.TAURI_ENV_PLATFORM == "windows" ? "chrome105" : "safari13",
},
resolve: {
alias: {
"@": resolve(import.meta.dirname, "./src"),
},
},
test: {
environment: "jsdom",
},
define: {
"import.meta.env.VITE_PLATFORM": JSON.stringify(os.platform()),
},
});