Skip to content

feat: pre-bundle plugin to dist/index.js to eliminate JITI startup latency#353

Merged
jalehman merged 4 commits into
mainfrom
copilot/fix-extreme-cli-startup-latency
Apr 10, 2026
Merged

feat: pre-bundle plugin to dist/index.js to eliminate JITI startup latency#353
jalehman merged 4 commits into
mainfrom
copilot/fix-extreme-cli-startup-latency

Conversation

Copilot AI commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

OpenClaw's JITI loader re-transpiles every .ts file on each CLI invocation. Because lossless-claw ships raw TypeScript, this causes 15–25s startup delays for any openclaw command while the plugin is installed.

Changes

  • Build step: Adds esbuild (devDependency) and a build script that bundles index.tsdist/index.js (single 701kb ESM file, ~37ms build time). Runtime packages provided by the OpenClaw host (openclaw, @mariozechner/*) are externalized.

    esbuild index.ts --bundle --platform=node --target=node22 --format=esm \
      --outfile=dist/index.js --external:openclaw --external:"@mariozechner/*"
    
  • Package entrypoints: main and openclaw.extensions updated from ./index.ts./dist/index.js.

  • Published files: files now ships dist/ instead of raw .ts sources; TypeScript source stays in the repo but is no longer distributed to NPM consumers.

  • release:verify: Now runs npm run build before packing.

  • Dockerfile: Removes || true guard — build is now deterministic.

Copilot AI changed the title [WIP] Fix extreme CLI startup latency due to TS compilation feat: pre-bundle plugin to dist/index.js to eliminate JITI startup latency Apr 10, 2026
Copilot AI requested a review from jalehman April 10, 2026 00:18
Add the bundle build step to the publish workflow so clean-checkout
releases include dist/index.js before npm publish runs. This keeps the
published tarball aligned with the new dist-based package entrypoints.

Regeneration-Prompt: |
  The PR switched the package entrypoint and published files to dist/index.js,
  but the GitHub publish workflow still ran npm ci, npm test, then npm publish
  from a clean checkout. Address the release blocker with the smallest change:
  update the publish path so the bundle is built before publishing, without
  changing unrelated bundling behavior. Verify with the existing release check
  that the tarball includes dist/index.js.
@jalehman jalehman marked this pull request as ready for review April 10, 2026 22:30
@jalehman jalehman merged commit 6fa2829 into main Apr 10, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Performance/Upstream] Extreme CLI startup latency exacerbated by TS compilation & OpenClaw JITI loader

2 participants