vite.config.ts 912 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. publicDir: "../app/public",
  8. // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
  9. //
  10. // 1. prevent Vite from obscuring rust errors
  11. clearScreen: false,
  12. esbuild: {
  13. // Improves production stack traces
  14. keepNames: true,
  15. },
  16. // build: {
  17. // sourcemap: true,
  18. // },
  19. // 2. tauri expects a fixed port, fail if that port is not available
  20. server: {
  21. port: 1420,
  22. strictPort: true,
  23. host: host || false,
  24. hmr: host
  25. ? {
  26. protocol: "ws",
  27. host,
  28. port: 1421,
  29. }
  30. : undefined,
  31. watch: {
  32. // 3. tell Vite to ignore watching `src-tauri`
  33. ignored: ["**/src-tauri/**"],
  34. },
  35. },
  36. })