fix(electron): restore packaged desktop app loading (#1095)

* fix(electron): restore packaged desktop app loading

Rebuild and verify Electron native modules before packaging and use the Vite base URL for packaged asset preloads.

* test(preload-utils): cover non-root base urls
This commit is contained in:
Tommaso Casaburi
2026-03-17 17:04:47 +08:00
committed by GitHub
parent f812fe1d18
commit c9bd6258b2
6 changed files with 93 additions and 12 deletions
+10
View File
@@ -47,3 +47,13 @@ If uncertain, ask the developer before adding an entry.
- **Impact:** Agents may “fix” the unlisted import by adding `@plebbit/plebbit-js` to `package.json`, which violates project policy.
- **Mitigation:** Do not add `@plebbit/plebbit-js` to `package.json` for this repo. If `knip` flags `electron/start-plebbit-rpc.js`, handle it with a targeted `ignoreIssues` entry instead.
- **Status:** confirmed
### Electron packaging can ship a broken `better-sqlite3` binary
- **Date:** 2026-03-17
- **Observed by:** Codex
- **Context:** Investigating the `v0.7.1` macOS arm64 DMG after the app showed a live IPFS node but never loaded boards or comments.
- **What was surprising:** The packaged app can start IPFS successfully while `electron/start-plebbit-rpc.js` loops forever because `/Applications/5chan.app/.../better_sqlite3.node` was built for plain Node 22 (`NODE_MODULE_VERSION 127`) instead of Electron 36 (`NODE_MODULE_VERSION 135`).
- **Impact:** The local RPC server on `ws://localhost:9138` never starts, so the desktop app cannot load boards, posts, or comments even though node stats look healthy.
- **Mitigation:** Before any Electron package/build job, run `yarn electron:prepare-package` so `better-sqlite3` is rebuilt for Electron and immediately verified via `ELECTRON_RUN_AS_NODE=1 electron`.
- **Status:** confirmed