import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

// https://vitejs.dev/config/
export default defineConfig(async () => ({
  plugins: [react()],
  // Tauri dev server: listen on all interfaces, fixed port.
  server: {
    port: 5173,
    strictPort: true,
    host: '0.0.0.0',
    hmr: {
      protocol: 'ws',
      host: 'localhost',
    },
  },
  // Prevent Vite from obscuring Rust compilation errors.
  clearScreen: false,
  // Tauri expects a fixed port.
  envPrefix: ['VITE_', 'TAURI_'],
}))
