Repository navigation
fix(app): build Electron funzionante nel monorepo (app-builder ENOENT) - #35
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
It changes production packaging/main-process bundling that the author notes is unverified on Windows/macOS and on a real packaged launch, and the app has no automated test coverage, so cross-platform human verification is needed.
0 open findings
What changed in this PR
This PR fixes the Electron packaging build in the npm-workspaces monorepo. electron-builder 25's "installing production dependencies" step runs npm install --production at the workspace root, which prunes app-builder-bin from the shared node_modules and causes the subsequent app-builder spawn to fail with ENOENT (issue #26). It disables that rebuild step and, as a related latent fix, bundles mappit-core into the main process so the packaged app (which ships without node_modules) works at startup.
Changes:
- Set
npmRebuild: falsein electron-builder config to stop the production-deps install that deletesapp-builder-bin. - Exclude
mappit-corefromexternalizeDepsPluginand alias it to../core/src/index.tsso it is bundled into the main process from source.
| File | Description |
|---|---|
| packages/app/package.json | Adds npmRebuild: false to the electron-builder config to avoid the ENOENT-causing dependency install. |
| packages/app/electron.vite.config.ts | Bundles mappit-core into the main process from source via externalizeDepsPlugin exclude + a resolve alias, with an explanatory comment. |
I verified that only packages/app/src/main/index.ts imports mappit-core as runtime values (renderer/preload/shared use import type), so aliasing only in the main config is sufficient. I also confirmed the Node-only transitive dependencies (stream-json, ora, yargs) live solely in cli.ts, which is not re-exported by src/index.ts, so bundling core from source does not drag them into the main bundle. resolve is correctly imported from node:path, and the exclude option is a valid externalizeDepsPlugin parameter. I found no concrete code issues to comment on.
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- npmRebuild: false: electron-builder lanciava npm install --production alla radice dei workspaces, cancellando le devDependencies (incluso app-builder-bin) e causando lo spawn ENOENT - mappit-core incluso nel bundle del main dai sorgenti: l'app pacchettizzata non contiene node_modules, quindi il require esterno sarebbe fallito Closes #26 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CecUKcJiSVnehcZEiXLgtk
731b387 to
a14354a
Compare
- --publish never nel job di CI: in CI electron-builder tenta il publish e fallisce senza repository; le release sono materia di #28 - homepage, repository ed email dell'autore in packages/app: richiesti dal target deb Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CecUKcJiSVnehcZEiXLgtk
Closes #26
Causa
Durante "installing production dependencies", electron-builder 25 esegue
npm install --productionalla radice dei workspaces. Questo elimina le devDependencies dalnode_modulescondiviso, compresoapp-builder-bin, e subito dopo lo spawn diapp-builderfallisce con ENOENT.Fix
npmRebuild: falsenella config di electron-builder: l'app non ha moduli nativi e il codice è già nel bundle di electron-vite.mappit-coreincluso nel bundle del main a partire dai sorgenti. Prima restava come require esterno, ma l'app pacchettizzata non includenode_modulese si sarebbe rotta all'avvio.--publish nevernel job di build. In CI electron-builder tentava il publish e falliva per mancanza direpository; le release sono materia di Release su GitHub con i binari dell'app #28.packages/app/package.json: aggiuntihomepage,repositoryed email dell'autore (GitHub noreply), richiesti dal target deb.Verifiche
🤖 Generated with Claude Code
https://claude.ai/code/session_01CecUKcJiSVnehcZEiXLgtk