vite.config.ts 882 B

12345678910111213141516171819202122232425262728293031323334353637
  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. esbuild: {
  12. // Improves production stack traces
  13. keepNames: true,
  14. },
  15. // build: {
  16. // sourcemap: true,
  17. // },
  18. // 2. tauri expects a fixed port, fail if that port is not available
  19. server: {
  20. port: 1420,
  21. strictPort: true,
  22. host: host || false,
  23. hmr: host
  24. ? {
  25. protocol: "ws",
  26. host,
  27. port: 1421,
  28. }
  29. : undefined,
  30. watch: {
  31. // 3. tell Vite to ignore watching `src-tauri`
  32. ignored: ["**/src-tauri/**"],
  33. },
  34. },
  35. })