fix: include web app dist in packaged Electron app#72
Conversation
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).
There was a problem hiding this comment.
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/disttoextraResourcesso it’s copied intoResources/web/distat 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.
| - from: 'packages/web/dist' | ||
| to: 'web/dist' |
There was a problem hiding this comment.
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.
| - from: 'packages/web/dist' | |
| to: 'web/dist' | |
| - from: 'packages/web' | |
| to: 'web' |
There was a problem hiding this comment.
Fixed: added `yarn build:web` to the `build` script so web dist is always generated before packaging.
Summary
/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 layoutpackages/web/dist→Resources/web/disttoextraResourcesinelectron-builder.yml../web/dist(production: sibling underResources/) and../../web/dist(dev:packages/server/src→packages/web/dist)Test plan
yarn build+yarn testpasselectron-builder --mac --dirResources/web/dist/contains index.html, assets, sw.jscurl http://localhost:{port}/app/returns 200 with HTML