[READ-ONLY] Mirror of https://github.com/sxzz/tauri-fetch-abort.
754 B
30 lines
1import { defineConfig } from "vite";
2
3// @ts-expect-error process is a nodejs global
4const host = process.env.TAURI_DEV_HOST;
5
6// https://vite.dev/config/
7export default defineConfig(async () => ({
8
9 // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
10 //
11 // 1. prevent Vite from obscuring rust errors
12 clearScreen: false,
13 // 2. tauri expects a fixed port, fail if that port is not available
14 server: {
15 port: 1420,
16 strictPort: true,
17 host: host || false,
18 hmr: host
19 ? {
20 protocol: "ws",
21 host,
22 port: 1421,
23 }
24 : undefined,
25 watch: {
26 // 3. tell Vite to ignore watching `src-tauri`
27 ignored: ["**/src-tauri/**"],
28 },
29 },
30}));