Skip to content

Commit 7e71921

Browse files
committed
build: bundle all non-native runtime deps into dist/cli.js
The previous build.mjs externalized 11 packages at bundle time, which forced every downstream consumer to provide them at runtime via an ancestor node_modules/. That worked for `npm i -g kanban` and monorepo dev, but the Electron packaging context ships dist/ to a location with no ancestor node_modules/, so the externals couldn't resolve there. Drop the externals list to just `node-pty` (the only genuinely non-bundlable package — it's a native addon with a compiled binding and a spawn-helper binary on disk). esbuild inlines the other 10: @sentry/node, proper-lockfile, tree-kill, ws, open, @trpc/client, @trpc/server, @modelcontextprotocol/sdk, commander, zod. Result: dist/cli.js is a single self-contained 16MB bundle with one runtime-resolved external (node-pty). In the Electron packaging PR downstream, node-pty gets rebuilt for Electron's ABI by electron-builder's install-app-deps into Resources/app.asar.unpacked/node_modules/, and cli.js resolves it via standard ESM walk-up from its own location inside app.asar.unpacked/. No dist/node_modules/ staging, no build-time `npm install`, no duplicate node-pty, no version drift between what esbuild saw and what the runtime resolves. scripts/build.mjs drops from ~190 lines (including the staging code the reviewer flagged as unusual) to ~60 lines of pure esbuild config.
1 parent d8b1605 commit 7e71921

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

scripts/build.mjs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
import * as esbuild from "esbuild";
22

3-
/** Modules that must stay external (native addons, large runtime deps). */
4-
const external = [
5-
"node-pty",
6-
"@sentry/node",
7-
"proper-lockfile",
8-
"tree-kill",
9-
"ws",
10-
"open",
11-
"@trpc/client",
12-
"@trpc/server",
13-
"@modelcontextprotocol/sdk",
14-
"commander",
15-
"zod",
16-
];
3+
/**
4+
* Runtime externals. `node-pty` is a native addon with a compiled binding
5+
* and a spawn-helper binary that must live on disk, so it can't be bundled.
6+
* Everything else esbuild can inline.
7+
*/
8+
const external = ["node-pty"];
179

1810
/** Bake OTEL telemetry env vars into the bundle at build time. */
1911
const define = {

0 commit comments

Comments
 (0)