initial commit
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
# Local Dev Server (Vite)
|
||||
|
||||
Start: `npx vite --host 0.0.0.0 --port 5173`
|
||||
|
||||
## vite.config.ts requirements
|
||||
|
||||
### 1. Proxy rewrite (critical)
|
||||
Vite's proxy prefix stripping is unreliable. Always explicit:
|
||||
```ts
|
||||
### 1. Proxy rewrites
|
||||
|
||||
```
|
||||
'/pb': {
|
||||
target: 'http://127.0.0.1:8091',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/pb/, ''),
|
||||
},
|
||||
'/deepseek': {
|
||||
target: 'https://localhost',
|
||||
changeOrigin: true,
|
||||
secure: false, // localhost self-signed cert
|
||||
rewrite: (path) => path.replace(/^\/deepseek/, '/deepseek'),
|
||||
},
|
||||
```
|
||||
|
||||
**Important:** The `/deepseek` proxy MUST route through the local nginx server (`localhost:443`), NOT directly to Ollama or api.deepseek.com. The nginx config adds the `Authorization` header with the DeepSeek API key. Without routing through nginx, AI calls will fail with authentication errors in dev mode.
|
||||
```
|
||||
|
||||
### 2. PocketBase SDK `import` keyword error
|
||||
pb SDK v0.27.0 uses `import` as a class method name at line ~28540:
|
||||
`async import(e, t = !1, s)`
|
||||
|
||||
Vite's esbuild pre-bundler leaves `import` as-is. Browsers reject it as syntax error.
|
||||
|
||||
**Two-part fix:**
|
||||
1. vite.config.ts: `optimizeDeps: { exclude: ['pocketbase'] }`
|
||||
2. Patch source: `sed -i 's/async import(/async _import(/g' node_modules/pocketbase/dist/pocketbase.es.mjs`
|
||||
3. Clear cache: `rm -rf node_modules/.vite`
|
||||
|
||||
## PocketBase Admin (v0.39.x)
|
||||
|
||||
- Superuser auth: `POST /api/collections/_superusers/auth-with-password` (NOT `/api/admins/...`)
|
||||
- Create superuser: `docker exec pocketbase /usr/local/bin/pocketbase superuser create <email> <pass> --dir /pb_data`
|
||||
- Create collections via superuser token from auth endpoint
|
||||
Reference in New Issue
Block a user