chore(desktop): add dependencies for routing and QR code

- Add react-router-dom for client-side routing
- Add qrcode.react for QR code generation
- Update vite.config.ts with path aliases

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jiang Bohan 2026-02-03 18:25:52 +08:00
parent 864d9166fc
commit 70cee08317
3 changed files with 174 additions and 23 deletions

View file

@ -3,6 +3,7 @@ import path from 'node:path'
import electron from 'vite-plugin-electron/simple'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import { builtinModules } from 'node:module'
// https://vitejs.dev/config/
export default defineConfig({
@ -12,6 +13,43 @@ export default defineConfig({
electron({
main: {
entry: 'electron/main.ts',
vite: {
build: {
rollupOptions: {
// Externalize all node_modules - they'll be resolved at runtime
// This is necessary because we import from src/hub which has many Node.js dependencies
external: [
'electron',
...builtinModules,
...builtinModules.map(m => `node:${m}`),
// Add specific packages that should not be bundled
'socket.io-client',
'uuid',
'chokidar',
'fast-glob',
'linkedom',
'undici',
'turndown',
'@mozilla/readability',
'pino',
'pino-pretty',
'yaml',
'json5',
'@mariozechner/pi-agent-core',
'@mariozechner/pi-ai',
'@mariozechner/pi-coding-agent',
],
},
},
resolve: {
alias: {
// Allow importing from root src/
'@multica/hub': path.resolve(__dirname, '../../src/hub'),
'@multica/agent': path.resolve(__dirname, '../../src/agent'),
'@multica/sdk': path.resolve(__dirname, '../../packages/sdk/src'),
},
},
},
},
preload: {
input: path.join(__dirname, 'electron/preload.ts'),