Files
chat/mobile/vite.config.ts
zeekay df6ebe0690 feat(mobile): scaffold Hanzo AI mobile app (Tauri v2 + React 19 + @hanzo/gui)
Self-contained mobile/ app (not in any workspace):
- Tauri v2 shell (productName "Hanzo AI", id ai.hanzo.chat) with fs + http
  plugins, scoped capabilities (fs: ~/.codex ~/.claude ~/.hanzo; http:
  chatgpt.com, api.anthropic.com, api.hanzo.ai, claude.ai, hanzo.chat).
- React 19 + Vite + @hanzo/gui (createGui + defaultConfig from
  @hanzogui/config/v5). Three state-nav screens: Chat, Sessions, Usage.
- Chat -> POST /api/agents/v1/chat/completions (OpenAI-compatible);
  Sessions -> GET /api/convos; both Bearer-auth. Usage via @hanzo/usage
  (createTauriHost + useUsage), connect empty-state outside Tauri.
- Bearer token via VITE_CHAT_TOKEN or paste screen (localStorage); IAM TODO.
- Rust engine/node feature flags OFF by default; cfg-gated engine_status +
  device_register stubs pointing at hanzoai/engine + hanzoai/node.

vite build green; cargo check green (default + engine,node).
2026-07-07 15:29:38 -07:00

36 lines
1.1 KiB
TypeScript

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// @hanzo/gui is a Tamagui fork: its web build reaches for `react-native`
// primitives, so we alias them to `react-native-web` (the same wiring the
// hanzoai/status Vite app uses). No Tamagui compiler plugin — runtime config
// via GuiProvider is enough for a mobile webview and keeps the build simple.
//
// Tauri: the dev server must stay on a fixed host/port so the Rust shell can
// point its WebView at it (see src-tauri/tauri.conf.json `devUrl`).
export default defineConfig({
plugins: [react()],
clearScreen: false,
resolve: {
alias: {
'react-native': 'react-native-web',
},
},
define: {
// Tamagui reads this to pick the web output at bundle time.
'process.env.TAMAGUI_TARGET': JSON.stringify('web'),
},
build: {
outDir: 'dist',
emptyOutDir: true,
// Match tsconfig (ES2022); esbuild refuses to downlevel some dependency
// syntax to vite's legacy baseline. Mobile webviews are modern.
target: 'es2022',
},
server: {
host: '0.0.0.0',
port: 1420,
strictPort: true,
},
})