-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.js
More file actions
39 lines (36 loc) · 1.08 KB
/
Copy pathvite.config.js
File metadata and controls
39 lines (36 loc) · 1.08 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
import { defineConfig } from "vite";
import { sveltekit } from "@sveltejs/kit/vite";
// @ts-expect-error process is a nodejs global
const host = process.env.TAURI_DEV_HOST;
export default defineConfig(async () => ({
plugins: [sveltekit()],
// Do not obscure rust errors.
clearScreen: false,
// Tauri expects a fixed port.
server: {
port: 1420,
strictPort: true,
host: host || false,
// The Tauri webview fires its whole preload graph at once and can request a component's style
// chunk before it is compiled, so Vite serves raw .svelte source as CSS. Warming the graph
// closes the race.
warmup: {
clientFiles: ["./src/**/*.svelte"],
},
hmr: host
? {
protocol: "ws",
host,
port: 1421,
}
: undefined,
watch: {
ignored: ["**/src-tauri/**"],
},
// SvelteKit narrows Vite's allow list to src/ and node_modules/. The workspace packages are
// linked into node_modules but resolve to packages/, so their fonts need allowing there.
fs: {
allow: ["packages"],
},
},
}));