perf(build): minify main process and lazy-load tiktoken rank table

Enable esbuild minification for main/preload (was renderer-only by default),
reducing main process bundle by ~55%. Extract cl100k_base BPE rank table out
of the synchronous startup path via dynamic import — it now lands in its own
chunk and is loaded on first agent run instead of at app startup.

Also fix Windows CI step to use PowerShell syntax for version injection.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
diguaandClaude Opus 4.8 committed 2026-06-03 00:46:34 +08:00
1 parent 3ff9437510
commit 2f8591fb8c
8 files changed
+89 -25

No files matched your search

+6 -5
View File
@@ -203,17 +203,18 @@ jobs:
pnpm install --frozen-lockfile
- name: Inject version into app package.json
shell: bash
shell: pwsh
run: |
VERSION="${{ needs.prepare_release.outputs.version }}"
echo "Injecting version: $VERSION"
$env:RELEASE_VERSION = "${{ needs.prepare_release.outputs.version }}"
Write-Host "Injecting version: $env:RELEASE_VERSION"
node -e "
const fs = require('fs');
const version = process.env.RELEASE_VERSION;
for (const p of ['apps/desktop/package.json', 'apps/cli/package.json']) {
const pkg = JSON.parse(fs.readFileSync(p, 'utf-8'));
pkg.version = '${VERSION}';
pkg.version = version;
fs.writeFileSync(p, JSON.stringify(pkg, null, 2) + '\n');
console.log(p + ' → ' + '${VERSION}');
console.log(p + ' -> ' + version);
}
"