chore(desktop): upgrade electron to v40#1194
Conversation
📝 WalkthroughWalkthroughDependency version bumps: desktop app dependency updates in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@apps/desktop/package.json`:
- Around line 188-189: Update packaging to rebuild native modules for Electron
40: add an `@electron/rebuild` step (or enable electron-builder's "npmRebuild" /
"asarUnpack" workflow) so native modules like better-sqlite3 (v12.6.2) and
node-pty (v1.1.0) are rebuilt against Electron 40 / Node 24.11.1 before
bundling; ensure your build script that runs when "electron": "40.0.0" is used
invokes `@electron/rebuild` or equivalent. Also audit renderer code for direct use
of clipboard and move clipboard access into a preload script exposed via
contextBridge (replace direct renderer calls with an ipc/contextBridge wrapper)
so clipboard is not accessed from renderer processes.
| "electron": "40.0.0", | ||
| "electron-builder": "^26.4.0", |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
Electron 40 release notes breaking changes
💡 Result:
Electron v40.0.0 breaking changes (per official release notes / breaking-changes docs):
- Deprecated: Using the
clipboardAPI directly from renderer processes. If you need clipboard from a renderer, move the call to a preload and expose it viacontextBridge. [1][2] - Behavior change (debug symbols): macOS dSYM artifacts switched from
dsym.ziptodsym.tar.xz(xz compression) to support larger files; tooling that downloads/consumes Electron dSYMs may need to handle.tar.xz. [1][2]
Sources: [1] Electron v40.0.0 release notes, [2] Electron “Breaking Changes” (Planned Breaking API Changes 40.0).
🌐 Web query:
Electron 40 Node 22.15 native module compatibility
💡 Result:
Electron 40.0.0 ships with Node.js 24.11.1, not Node 22.15.0. So a native addon binary built against Node 22.15.0’s Node-ABI (NODE_MODULE_VERSION) generally will not load in Electron 40—you must use an Electron-40 build (or rebuild from source) of the module. [1][2]
What to do:
- If the module uses Node-ABI (most
node-gypaddons): rebuild it for Electron 40 (recommended tool:@electron/rebuild). Electron explicitly requires native modules be recompiled for Electron’s ABI. [2][3] - If the module uses N-API (“napi” builds): it’s often portable across Node/Electron versions. Node 22.15.0 reports N-API v127, and a N-API addon built for a given N-API version typically works on runtimes that support that version. Still, prefer Electron-specific prebuilds when available, or rebuild if you hit load/link errors. [4][2]
If you specifically need Node 22.15 compatibility, that corresponds to older Electron nightlies/branches, not Electron 40 stable. (Electron 40 stable is already on Node 24.) [1]
Sources: Electron 40 release metadata (Node 24.11.1) [1]; Electron native module ABI guidance [2]; @electron/rebuild purpose [3]; Node 22.15.0 N-API version [4].
🌐 Web query:
better-sqlite3 node-pty Electron 40 compatibility
💡 Result:
Electron 40.0.0 (released Jan 13, 2026) ships with Node.js 24.11.1 (plus Chromium 144 / V8 14.4). That means native addons must be rebuilt (or have prebuilds) targeting Electron 40’s ABI, not your system Node. [1][2][3]
better-sqlite3 ↔ Electron 40
- Electron 40’s embedded Node 24 generally requires better-sqlite3 v12.x (older major versions won’t load/build against newer Node ABIs). Community tracking around Node 24 support also notes that early v12.0.0 had missing prebuilds in some cases—so prefer v12.1.0+ if you want the best chance of available prebuilds. [4][5]
- If you don’t get a matching prebuild for Electron 40, rebuild it for Electron (not Node) using @electron/rebuild (Electron docs recommend this approach for native modules). [6]
node-pty ↔ Electron 40
node-ptyis also a native addon, so it has the same rule: it must be compiled for Electron’s ABI. (Upstream notes Node/Electron minimums and expects builds aligned with the Electron/VS Code toolchain.) [7]- If you want prebuilt binaries, a common approach is switching from
node-ptyto @homebridge/node-pty-prebuilt-multiarch; it downloads a matching prebuild when available and otherwise falls back to building via node-gyp. Whether Electron 40 prebuilds exist depends on that package’s release artifacts, but the fallback build path is built-in. [8][9]
Practical compatibility checklist (Electron 40)
- Pin/upgrade native deps:
better-sqlite3: >= 12.1.0 (often safest for Node 24-era builds/prebuilds). [4][5]node-pty: either rebuild from source for Electron 40, or consider the Homebridge prebuilt fork. [6][8][9]
- Ensure your install/CI runs an Electron-native rebuild step (e.g.
@electron/rebuild) so packaged apps don’t ship Node-built.nodebinaries. [6]
Sources: Electron 40 release details [1][2][3], Electron native module rebuild guidance [6], better-sqlite3 Node 24/prebuild context [4][5], node-pty / prebuilt fork behavior [7][8][9].
Ensure native modules are rebuilt for Electron 40 (Node 24.11.1), and verify clipboard API usage.
Electron 40.0.0 ships with Node 24.11.1 (not 22.15). Both better-sqlite3 (v12.6.2) and node-pty (v1.1.0) must be rebuilt against Electron 40's native ABI—prebuilt binaries for Node 22 will not load. Use @electron/rebuild during packaging to ensure bundled modules target Electron's runtime.
Additionally, verify that the application does not use the clipboard API directly from renderer processes; this is now deprecated in Electron 40 and must be moved to a preload script exposed via contextBridge.
🤖 Prompt for AI Agents
In `@apps/desktop/package.json` around lines 188 - 189, Update packaging to
rebuild native modules for Electron 40: add an `@electron/rebuild` step (or enable
electron-builder's "npmRebuild" / "asarUnpack" workflow) so native modules like
better-sqlite3 (v12.6.2) and node-pty (v1.1.0) are rebuilt against Electron 40 /
Node 24.11.1 before bundling; ensure your build script that runs when
"electron": "40.0.0" is used invokes `@electron/rebuild` or equivalent. Also audit
renderer code for direct use of clipboard and move clipboard access into a
preload script exposed via contextBridge (replace direct renderer calls with an
ipc/contextBridge wrapper) so clipboard is not accessed from renderer processes.
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
- electron 39.1.2 → 40.0.0 - electron-builder ^26.0.12 → ^26.4.0 - electron-updater 6 → ^6.7.3 - @sentry/electron ^7.5.0 → ^7.5.1 - better-sqlite3 12.5.0 → 12.6.2 - node-pty 1.1.0-beta30 → 1.1.0 (stable) - turbo ^2.5.8 → ^2.8.3
e27d275 to
6bb3316
Compare
electron-builder 26.7.0's dependency traversal requires prebuild-install to be resolvable as a production dependency of better-sqlite3.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@apps/desktop/package.json`:
- Line 47: The dependency entry for "@sentry/electron" currently uses an invalid
version string "^7.5.1"; update the version in package.json to a published
release (e.g. "7.5.0", "7.6.0", or "7.7.0") by replacing "^7.5.1" with the
chosen valid version, then run your package manager (npm/yarn/pnpm) to
regenerate the lockfile and install the correct package; ensure the change is
committed so CI uses the updated lockfile.
7.5.1 does not exist as a published version.
Summary
electron-builder^26.0.12 → ^26.4.0electron-updater6 → ^6.7.3@sentry/electron^7.5.0 → ^7.5.1better-sqlite312.5.0 → 12.6.2node-pty1.1.0-beta30 → 1.1.0 (stable release)turbo^2.5.8 → ^2.8.3No breaking API changes — the codebase uses modern Electron patterns (contextBridge, preload scripts, IPC).
electron-vitekept at v4 since v5 introduces ESM resolution issues with workspace packages.Test plan
bun run compile:appbuilds successfullybun run typecheckpasses with 0 errorsbun run dev)Summary by CodeRabbit