# Vite Dev Server Setup ## Config `vite.config.ts` in project root. Key sections: ```ts export default defineConfig({ plugins: [react(), tailwindcss()], optimizeDeps: { exclude: ['pocketbase'], // REQUIRED: SDK uses `import` as method name, breaks esbuild pre-bundle }, server: { proxy: { '/pb': { target: 'http://127.0.0.1:8091', changeOrigin: true, rewrite: (path) => path.replace(/^\/pb/, ''), // REQUIRED: strip /pb prefix }, '/deepseek': { target: 'http://127.0.0.1:11434', changeOrigin: true, }, }, }, }) ``` ## PocketBase SDK + Vite Compatibility PocketBase SDK v0.27.0 uses `import` as a method name (`async import(e, t, s)` in CollectionService). Vite's esbuild pre-bundler leaves it as-is, and browsers reject `import(` as invalid syntax in module scope. **Fix**: `optimizeDeps: { exclude: ['pocketbase'] }` — tells Vite to serve the raw ESM file. The raw ESM also has `async import(` at position 28540, so the source file needs patching too: ```bash sed -i 's/async import(/async _import(/g' node_modules/pocketbase/dist/pocketbase.es.mjs ``` This rename doesn't break functionality since it's an internal method name. ## Starting the server ```bash cd /mnt/seagate8tb/Websites/ShopProQuote.backup-20260626-2058/spq-v2 npx vite --host 0.0.0.0 --port 5173 ``` Then: `http://localhost:5173` or `http://192.168.50.98:5173` To kill: `pkill -f "node.*vite"` (NOT `pkill node` which kills the shell too)