Skip to content

fix(app): build Electron funzionante nel monorepo (app-builder ENOENT) - #35

Merged
ronzim merged 2 commits into
masterfrom
fix/26-electron-ci
Oct 14, 2026
Merged

ronzim merged 2 commits into
masterfrom
fix/26-electron-ci

Conversation

@ronzim

@ronzim ronzim commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Closes #26

Causa

Durante "installing production dependencies", electron-builder 25 esegue npm install --production alla radice dei workspaces. Questo elimina le devDependencies dal node_modules condiviso, compreso app-builder-bin, e subito dopo lo spawn di app-builder fallisce con ENOENT.

Fix

  • npmRebuild: false nella config di electron-builder: l'app non ha moduli nativi e il codice è già nel bundle di electron-vite.
  • mappit-core incluso nel bundle del main a partire dai sorgenti. Prima restava come require esterno, ma l'app pacchettizzata non include node_modules e si sarebbe rotta all'avvio.
  • CI: --publish never nel job di build. In CI electron-builder tentava il publish e falliva per mancanza di repository; le release sono materia di Release su GitHub con i binari dell'app #28.
  • packages/app/package.json: aggiunti homepage, repository ed email dell'autore (GitHub noreply), richiesti dal target deb.

Verifiche

  • CI verde: lint, test (Node 20/22), typecheck e build Electron su ubuntu, windows e macos
  • In locale (Linux): AppImage e deb generati
  • Non verificato: l'avvio reale dell'app pacchettizzata

🤖 Generated with Claude Code

https://claude.ai/code/session_01CecUKcJiSVnehcZEiXLgtk

Copilot AI balanced review requested due to automatic review settings October 14, 2026 06:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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: false in electron-builder config to stop the production-deps install that deletes app-builder-bin.
  • Exclude mappit-core from externalizeDepsPlugin and alias it to ../core/src/index.ts so 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
@ronzim
ronzim force-pushed the fix/26-electron-ci branch from 731b387 to a14354a Compare October 14, 2026 06:37
- --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
@ronzim
ronzim merged commit 0820af4 into master Oct 14, 2026
7 checks passed
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.

CI: il build Electron fallisce su tutte le piattaforme (app-builder ENOENT)

3 participants