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