Skip to content

fix(dev): run esbuild through its JS API — bin/esbuild is a native binary - #484

Merged
jackwener merged 1 commit into
mainfrom
fix/dev-esbuild-binary
Jul 3, 2026
Merged

fix(dev): run esbuild through its JS API — bin/esbuild is a native binary#484
jackwener merged 1 commit into
mainfrom
fix/dev-esbuild-binary

Conversation

@jackwener

Copy link
Copy Markdown
Member

npm run dev 在任何跑过 esbuild postinstall 的机器上必挂:dev.mjs 用 node node_modules/esbuild/bin/esbuild 执行,但 postinstall 会把该文件替换为平台原生二进制(darwin 上是 Mach-O)→ node 在第一个字节就抛 SyntaxError,preload/main 永远构建不出来(#456 作者机器能跑大概率是装依赖时跳过了 scripts)。

两处 esbuild 调用改为 JS APIesbuildBuild 等价参数):与二进制形态无关、跨平台、还省一个子进程。dev-startup 契约同步为断言 API 选项。

验证npm run dev 端到端跑通(增量构建 0.2s → vite :5173 → Electron 启动);1708/1708。

…nary
npm run dev crashed on any machine where esbuild's postinstall had
run: dev.mjs spawned `node node_modules/esbuild/bin/esbuild`, but
postinstall replaces that file with a platform-native executable
(Mach-O on darwin), so node threw SyntaxError on byte one and the
preload/main bundles never built.
Both esbuild invocations now use the JS API (esbuildBuild with
equivalent options: bundle/platform/format/packages/external), which
is binary-agnostic, cross-platform, and skips a child process. The
dev-startup contract now asserts the API options instead of CLI flags,
with the rationale inline.
Verified: npm run dev boots end-to-end (incremental build 0.2s, vite
on :5173, Electron launches). Desktop suite 1708/1708.
@jackwener
jackwener merged commit c9ec6ca into mainJul 3, 2026
@jackwener
jackwener deleted the fix/dev-esbuild-binary branch July 3, 2026 12:03
Astro-Han added a commit that referenced this pull request Jul 3, 2026
5 CSS files (daily-review, health-center, permission-center,
settings/connection, tool-stream) took main's format (@layer
removal, indentation) and re-applied foreground alias replacement
(40/50→muted-foreground, 60/70/80→foreground-secondary).
Sign up for freeto 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.

1 participant

@jackwener