Skip to content

fix: include web app dist in packaged Electron app#72

Merged
jcanizalez merged 2 commits intomainfrom
fix/web-app-packaging
Mar 20, 2026
Merged

fix: include web app dist in packaged Electron app#72
jcanizalez merged 2 commits intomainfrom
fix/web-app-packaging

Conversation

@jcanizalez
Copy link
Copy Markdown
Owner

Summary

  • Root cause: /app/ returned 404 in the packaged app because the web dist was never copied into the app bundle, and the relative path was wrong for the production layout
  • Added packages/web/distResources/web/dist to extraResources in electron-builder.yml
  • Made path resolution check both ../web/dist (production: sibling under Resources/) and ../../web/dist (dev: packages/server/srcpackages/web/dist)

Test plan

  • yarn build + yarn test pass
  • Built unpacked app with electron-builder --mac --dir
  • Verified Resources/web/dist/ contains index.html, assets, sw.js
  • Launched app, curl http://localhost:{port}/app/ returns 200 with HTML

The /app/ route returned 404 in the packaged app because:
1. Web dist was not included in extraResources (electron-builder.yml)
2. The relative path ../../web/dist was wrong for production layout
   where server and web are siblings under Resources/

Added web dist to extraResources and made the path resolution check
both ../web/dist (production) and ../../web/dist (dev).
Copilot AI review requested due to automatic review settings March 20, 2026 02:47
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes packaged-app /app/ returning 404 by ensuring the web UI build output is shipped inside the Electron bundle and by making the server resolve the static dist path correctly in both dev and production layouts.

Changes:

  • Add packages/web/dist to extraResources so it’s copied into Resources/web/dist at package time.
  • Update server-side static asset path resolution to check the production (../web/dist) and dev (../../web/dist) locations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/server/src/index.ts Adjusts webDistDir resolution so /app/ static serving works in both dev and packaged production layouts.
electron-builder.yml Packages the web app dist output into the Electron app’s Resources so it’s available at runtime.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +54 to +55
- from: 'packages/web/dist'
to: 'web/dist'
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

extraResources now copies from packages/web/dist, but the repo’s default yarn build (used by release workflow before yarn dist) does not run yarn build:web. On a clean CI runner this will likely fail packaging (missing source directory) or ship without the web assets. Consider updating the build/packaging pipeline (e.g., include yarn build:web in yarn build, add a prepack/predist script, or add an electron-builder beforePack hook) so packages/web/dist is always generated before electron-builder runs.

Suggested change
- from: 'packages/web/dist'
to: 'web/dist'
- from: 'packages/web'
to: 'web'

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed: added `yarn build:web` to the `build` script so web dist is always generated before packaging.

@jcanizalez jcanizalez merged commit a103c11 into main Mar 20, 2026
1 check passed
@jcanizalez jcanizalez deleted the fix/web-app-packaging branch March 20, 2026 03:03
This was referenced Mar 20, 2026
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