Resolve frontend assets at runtime in release bundles#38
Conversation
The HTTP server resolved its web-asset directory from the compile-time `CARGO_MANIFEST_DIR`, so a binary built in CI looked for `dist` at the build machine's checkout path (e.g. `/Users/runner/work/ide/ide/dist`), which doesn't exist on a user's machine. The landing page still rendered because it's server-side Rust, but opening a workspace served the SPA from the missing path and fell back to the "Build the web assets" message. The assets were never copied into the bundle either. Bundle `dist` as a Tauri resource and pick the serve directory at runtime from the app's resource dir, falling back to the source-tree path for `cargo run` / `tauri dev`. Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: GitButler <gitbutler@gitbutler.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to dynamically resolve the frontend assets directory at runtime instead of relying solely on the compile-time CARGO_MANIFEST_DIR path, which is unreliable in release bundles. It adds a resolve_frontend_dist helper function that checks the app's resource directory for bundled assets (falling back to the source-tree path for development), integrates it into the application startup, updates the Tauri bundle configuration to include the dist folder as a resource, and adds comprehensive unit tests. There are no review comments, and the changes look solid, so I have no additional feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
This PR fixes release bundles failing to serve the built SPA when opening a workspace by bundling dist into the Tauri app resources and resolving the HTTP server’s frontend asset directory at runtime (instead of using the compile-time CARGO_MANIFEST_DIR path that points to the CI/build machine).
Changes:
- Bundle
../distinto the Tauri app as a named resource (dist) for release builds. - Add a
resolve_frontend_disthelper to prefer the bundled resource dir at runtime, with a dev fallback to the source-treedist. - Add unit tests covering the resolver’s resource-dir and fallback behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src-tauri/tauri.conf.json | Adds dist to bundle resources so web assets ship inside the app bundle. |
| src-tauri/src/lib.rs | Resolves frontend assets directory at runtime and adds unit tests for the resolver. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Address PR review feedback: when the resource dir has no staged assets and the baked `CARGO_MANIFEST_DIR` path doesn't exist (a relocated bundle or unstaged resources in a release build), fall back to a resource-dir path instead of the build machine's checkout. Only use the manifest path when it actually exists on disk, which is the dev / `cargo run` case. Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: GitButler <gitbutler@gitbutler.com>
Summary
npm run build, then reload." when opening a workspace. The HTTP server resolved its asset directory from the compile-timeCARGO_MANIFEST_DIR, so a CI-built binary looked fordistat the build machine's checkout (/Users/runner/work/ide/ide/dist), which doesn't exist on a user's machine, and the assets were never copied into the bundle anyway.distas a Tauri resource (tauri.conf.json) so the web assets ship inside the.app.resolve_frontend_disthelper, falling back to the source-tree path forcargo run/tauri dev.Test plan
npm run tauri:check— config validator passescargo test resolve_frontend_dist— 3 new resolver unit tests passnpm run tauri:build— bundle builds;ide.app/Contents/Resources/dist/index.htmlpresent<div id="root">+ hashed JS asset 200s), zero "Build the web assets" hits