fix: resolve rcedit path at runtime to fix ENOENT on Windows#330
Open
Dyn4sty wants to merge 1 commit intoblackboardsh:mainfrom
Open
fix: resolve rcedit path at runtime to fix ENOENT on Windows#330Dyn4sty wants to merge 1 commit intoblackboardsh:mainfrom
Dyn4sty wants to merge 1 commit intoblackboardsh:mainfrom
Conversation
When the CLI is compiled with `bun build --compile`, dynamic
`import("rcedit")` freezes __dirname to the *build-machine* path
(e.g. D:\a\electrobun\... on the GitHub Actions runner) rather than
the runtime machine's path. On any developer machine without a D:\
drive, this causes:
spawn D:\a\electrobun\...\rcedit-x64.exe ENOENT
The system cannot find the drive specified.
Fix: replace all three `await import("rcedit")` call sites with a new
`spawnRcedit()` helper that locates rcedit-x64.exe at runtime using
`process.execPath`. Since electrobun.exe and rcedit are always sibling
packages in the consuming project's node_modules, we resolve:
dirname(process.execPath)/../../rcedit/bin/rcedit-x64.exe
This is always correct at runtime regardless of where the CLI binary
was originally compiled.
Fixes icon embedding for launcher.exe, bun.exe, and the Windows
installer EXE on machines whose drive layout differs from the CI runner.
Made-with: Cursor
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.
Problem
When
electrobun devorelectrobun buildruns on Windows and the project has a Windows icon configured, icon embedding intolauncher.exe,bun.exe, and the installer EXE silently fails with:Root cause: The CLI binary is compiled with
bun build --compileon the GitHub Actions runner whose workspace isD:\a\electrobun\. Bun's compiler freezes__dirname(inside the bundledrceditCJS module) to that build-machine path. On any developer machine without aD:\drive,path.resolve(__dirname, '..', 'bin', 'rcedit-x64.exe')resolves to a non-existent path.Fix
Replace all three
await import("rcedit")call sites with a newspawnRcedit()helper that resolves thercedit-x64.exepath at runtime usingprocess.execPath:Since
electrobun.exeandrceditare always sibling packages in the consuming project'snode_modules/, this path is correct at runtime on any machine, regardless of where the binary was compiled.Affected call sites
launcher.exe(~line 2166)bun.exe(~line 2263)Testing
Verified by reproducing the
ENOENTlocally (noD:\drive) and confirming all three call sites now correctly resolve to the localnode_modules/rcedit/bin/rcedit-x64.exe.