Skip to content

fix: move esbuild platform binaries to optionalDependencies - #635

Open
sanskarOH wants to merge 1 commit into
SuperCmdLabs:mainfrom
sanskarOH:fix/arm64-esbuild-install
Open

fix: move esbuild platform binaries to optionalDependencies#635
sanskarOH wants to merge 1 commit into
SuperCmdLabs:mainfrom
sanskarOH:fix/arm64-esbuild-install

Conversation

@sanskarOH

Copy link
Copy Markdown

What changed

Moved @esbuild/darwin-arm64 and @esbuild/darwin-x64 from dependencies to optionalDependencies in package.json (and regenerated package-lock.json to match).

Why

Fresh npm install fails on any single-arch Mac with:

npm error code EBADPLATFORM
npm error notsup Unsupported platform for @esbuild/darwin-x64@0.19.12: wanted {"os":"darwin","cpu":"x64"} (current:  {"os":"darwin","cpu":"arm64"})

npm treats platform-restricted packages as hard requirements when listed under regular dependencies, so it aborts install rather than skipping the incompatible binary. optionalDependencies is npm's correct mechanism for this — it installs the compatible binary and silently skips the other, which also aligns with the existing scripts/ensure-cross-arch-esbuild.mjs postinstall step that fetches the missing cross-arch binary separately.

Compatibility impact

None expected. Both binaries are still declared with pinned versions; only the dependency type changed. Cross-arch packaging (electron-builder producing both Intel and Apple Silicon builds) is unaffected since ensure-cross-arch-esbuild.mjs already handles fetching the missing binary post-install.

How I tested

  • npm install succeeds cleanly on an arm64 Mac (previously failed with EBADPLATFORM)
  • npm run build completes without errors (main, renderer, and native builds all pass)
  • npm run dev launches the app successfully with all core features (clipboard, snippets, commands) loading correctly
  • Verified node_modules/@esbuild/ contains the arm64 binary after install, and confirmed lockfile correctly reflects optionalDependencies

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.

2 participants