Files
aha/aha-ui/vite.config.ts
T

39 lines
936 B
TypeScript
Raw Normal View History

2026-04-25 12:57:56 +08:00
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
2026-04-25 13:12:44 +08:00
import tailwindcss from '@tailwindcss/vite'
import path from "node:path";
2026-04-25 12:57:56 +08:00
const host = process.env.TAURI_DEV_HOST;
// https://vite.dev/config/
export default defineConfig(async () => ({
2026-04-25 13:12:44 +08:00
plugins: [react(), tailwindcss(),],
2026-04-25 12:57:56 +08:00
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
//
// 1. prevent Vite from obscuring rust errors
clearScreen: false,
2026-04-25 13:12:44 +08:00
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
2026-04-25 12:57:56 +08:00
// 2. tauri expects a fixed port, fail if that port is not available
server: {
port: 1420,
strictPort: true,
host: host || false,
hmr: host
? {
2026-04-25 13:12:44 +08:00
protocol: "ws",
host,
port: 1421,
}
2026-04-25 12:57:56 +08:00
: undefined,
watch: {
// 3. tell Vite to ignore watching `src-tauri`
ignored: ["**/src-tauri/**"],
},
},
}));