| 1 | import { defineConfig } from "vite"; |
| 2 | import react from "@vitejs/plugin-react"; |
| 3 | import tailwindcss from "@tailwindcss/vite"; |
| 4 | import path from "node:path"; |
| 5 | |
| 6 | // Tauri expects a fixed port and doesn't like auto-increment. |
| 7 | const host = process.env.TAURI_DEV_HOST; |
| 8 | |
| 9 | export default defineConfig(async () => ({ |
| 10 | plugins: [react(), tailwindcss()], |
| 11 | resolve: { |
| 12 | alias: { |
| 13 | "@": path.resolve(__dirname, "src"), |
| 14 | }, |
| 15 | }, |
| 16 | clearScreen: false, |
| 17 | server: { |
| 18 | port: 1420, |
| 19 | strictPort: true, |
| 20 | host: host || false, |
| 21 | hmr: host |
| 22 | ? { protocol: "ws", host, port: 1421 } |
| 23 | : undefined, |
| 24 | watch: { |
| 25 | ignored: ["**/src-tauri/**"], |
| 26 | }, |
| 27 | }, |
| 28 | test: { |
| 29 | environment: "jsdom", |
| 30 | globals: true, |
| 31 | setupFiles: ["./src/test/setup.ts"], |
| 32 | }, |
| 33 | })); |