vite.config.ts 796 B

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