fix(FR-2607): align Electron publicPath patch with Vite output#7189
Merged
graphite-app[bot] merged 1 commit intomainfrom Apr 30, 2026
Conversation
3 tasks
This was referenced Apr 30, 2026
Merged
Member
Author
2 tasks
Contributor
Coverage Report for root-coverage
File Coverage
|
||||||||||||||||||||||||||||||||||||||
Contributor
Coverage Report for react-coverage (./react)
File CoverageNo changed files found. |
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns the Electron staging “publicPath” post-patch flow with Vite’s build output (/assets/...) so Electron can correctly load bundled assets via the custom es6:// scheme without requiring a second, Electron-specific Vite build.
Changes:
- Update the Electron post-patch script to rewrite Vite-style asset references (
/assets/...) inindex.htmland emitted CSS. - Adjust
dep_electronidempotency marker + failure propagation inMakefileto match the new patch behavior. - Remove the now-dead Electron-only
renderBuiltUrlbranch fromreact/vite.config.tsand drop unused CRA-era devDependencies fromreact/package.json.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/patch-electron-publicpath.js | Switch patching logic from CRA /static/... to Vite /assets/... and make verification fail fast. |
| Makefile | Update Electron prep skip-marker and ensure the patch step aborts the recipe on failure. |
| react/vite.config.ts | Remove unused Electron-specific Vite build branch; rely on single web build + post-patch. |
| react/package.json | Remove unused CRA-era devDependencies no longer referenced after Vite migration. |
467c14c to
af6555a
Compare
This was referenced Apr 30, 2026
c72fccf to
7bee5af
Compare
467c14c to
71899ca
Compare
Merge activity
|
Resolves the gap between PR #6871 (Vite spike for `es6://` publicPath via `renderBuiltUrl`) and PR #6765 / FR-2612 (single React build + post-patch policy). The post-patch script was still searching for CRA-era `/static/...` paths after the Vite migration emitted `/assets/...`, so `make dep` produced an Electron staging dir that referenced root-relative `/assets/...` that Electron could not serve via the `es6://` scheme handler. ## Verification (PR #7113 head, this fix applied) - `bash scripts/verify.sh` → Relay / Lint / Format / TypeScript ALL PASS - `make clean && make dep` → "Patched 2 file(s). Verification passed: index.html contains es6://assets/" - `make dep` run twice → idempotent skip ("Electron app already prepared, skipping") - `pnpm run electron:d` → renderer spawns with `es6://` scheme registered, login UI renders, all stylesheets load (rule counts > 0), body bg = rgb(247, 247, 246), `did-fail-load` / `webRequest err` / 404s = 0 - `make mac_arm64` → `compile_localproxy` + `electron-packager` (.app) produced cleanly. (DMG step fails on a local `NODE_MODULE_VERSION` mismatch in a globally-installed `electron-installer-dmg`; unrelated to this fix and does not affect CI which uses `npx`.) ## Changes ### `scripts/patch-electron-publicpath.js` - Replace CRA-era patch patterns (`/static/js`, `/static/css`, `asset-manifest.json`, webpack runtime `.p='/'` rewrites) with Vite-aware patterns. - Patch `index.html`: rewrite `="/assets/` → `="es6://assets/` on `src`/`href` attributes only. - Patch CSS files under `assets/`: `url(/assets/...)` → `url(es6://assets/...)` in all quote styles. - Drop dead Webpack-specific code paths (`asset-manifest.json`, `static/{js,css}`, webpack runtime `publicPath` assignment) that no longer exist in Vite output. - Update verification marker from `es6://static/js/main` to `es6://assets/`. - Leave `<base href="/">` untouched: the renderer loads `index.html` via `file://`, and rewriting `<base>` to `es6://` would break `window.location`/origin alignment (history API, same-origin checks). Webpack-era patch script also did not touch `<base>`. - Verification failure now exits non-zero so the Makefile recipe aborts instead of silently continuing. ### `Makefile` - Update `dep_electron` idempotency marker from `es6://static/js/main` to `es6://assets/` to match the new patch script. - Replace `;` chaining with `&&` between the `dep_electron` commands so a failed patch script aborts the recipe. - Update inline comment that referenced the old marker. ### `react/vite.config.ts` - Remove the `BUILD_TARGET=electron` + `experimental.renderBuiltUrl` branch (PR #6871 spike). FR-2612 mandates a single web build with post-patch; the `renderBuiltUrl` path would require a second `vite build` per release and was never wired into the Makefile, making it dead code with regression risk if anyone toggled `BUILD_TARGET=electron`. - Drop the now-unused `command` parameter from `defineConfig`. ### `react/package.json` - Remove three unused CRA-era devDependencies: `@svgr/webpack` (Vite uses `vite-plugin-svgr`), `react-scripts` (CRA core, retired in FR-2611), `react-dev-utils` (no imports anywhere). All three were verified to have zero references in source. ## Stack Sits on top of #7113 (FR-2606 residual build-time warnings).
71899ca to
5adac3e
Compare
2a0e6d6 to
f6c26dc
Compare
Base automatically changed from
04-28-fix_fr-2606_clear_residual_build-time_warnings_bui_dts_module_directive_
to
main
April 30, 2026 12:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Resolves the gap between PR #6871 (Vite spike for
es6://publicPath viarenderBuiltUrl) and PR #6765 / FR-2612 (single React build + post-patchpolicy). The post-patch script was still searching for CRA-era
/static/...paths after the Vite migration emitted
/assets/..., somake depproducedan Electron staging dir that referenced root-relative
/assets/...thatElectron could not serve via the
es6://scheme handler.Verification (PR #7113 head, this fix applied)
bash scripts/verify.sh→ Relay / Lint / Format / TypeScript ALL PASSmake clean && make dep→ "Patched 2 file(s). Verification passed: index.html contains es6://assets/"make deprun twice → idempotent skip ("Electron app already prepared, skipping")pnpm run electron:d→ renderer spawns withes6://scheme registered, login UI renders, all stylesheets load (rule counts > 0), body bg = rgb(247, 247, 246),did-fail-load/webRequest err/ 404s = 0make mac_arm64→compile_localproxy+electron-packager(.app) produced cleanly. (DMG step fails on a localNODE_MODULE_VERSIONmismatch in a globally-installedelectron-installer-dmg; unrelated to this fix and does not affect CI which usesnpx.)Changes
scripts/patch-electron-publicpath.js/static/js,/static/css,asset-manifest.json, webpack runtime.p='/'rewrites) with Vite-aware patterns.index.html: rewrite="/assets/→="es6://assets/onsrc/hrefattributes only.assets/:url(/assets/...)→url(es6://assets/...)in all quote styles.asset-manifest.json,static/{js,css}, webpack runtimepublicPathassignment) that no longer exist in Vite output.es6://static/js/maintoes6://assets/.<base href="/">untouched: the renderer loadsindex.htmlviafile://, and rewriting<base>toes6://would breakwindow.location/origin alignment (history API, same-origin checks). Webpack-era patch script also did not touch<base>.Makefiledep_electronidempotency marker fromes6://static/js/maintoes6://assets/to match the new patch script.;chaining with&&between thedep_electroncommands so a failed patch script aborts the recipe.react/vite.config.tsBUILD_TARGET=electron+experimental.renderBuiltUrlbranch (PR feat(FR-2607): Vite spike answer — es6:// Electron publicPath works via renderBuiltUrl #6871 spike). FR-2612 mandates a single web build with post-patch; therenderBuiltUrlpath would require a secondvite buildper release and was never wired into the Makefile, making it dead code with regression risk if anyone toggledBUILD_TARGET=electron.commandparameter fromdefineConfig.react/package.json@svgr/webpack(Vite usesvite-plugin-svgr),react-scripts(CRA core, retired in FR-2611),react-dev-utils(no imports anywhere). All three were verified to have zero references in source.Stack
Sits on top of #7113 (FR-2606 residual build-time warnings).