fix(browse): use --outdir for Windows node server build#924
Open
garrett-fox wants to merge 1 commit intogarrytan:mainfrom
Open
fix(browse): use --outdir for Windows node server build#924garrett-fox wants to merge 1 commit intogarrytan:mainfrom
garrett-fox wants to merge 1 commit intogarrytan:mainfrom
Conversation
bun build now emits native assets (ngrok) alongside the bundle, which makes --outfile fail with 'cannot write multiple output files without an output directory'. Switch to --outdir and rename server.js to server-node.mjs before the perl substitutions run. Verified on Bun v1.3.11 / Windows 11.
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
On Windows,
bash browse/scripts/build-node-server.shfails with:```
error: cannot write multiple output files without an output directory
```
because recent `bun build` (Bun v1.3.11) emits a native asset (`ngrok.win32-x64-msvc-*.node`, ~10 MB) alongside the main server bundle. When bun has multiple outputs, it rejects the `--outfile` flag.
The script crashes before producing `server-node.mjs`, so `browse.exe` can't start on Windows and every `$B` command dies with:
```
error: server-node.mjs not found. Run `bun run build` to generate the Windows server bundle.
```
Every fresh `./setup` or `gstack-upgrade` on Windows leaves `/browse` broken until someone rebuilds by hand.
Fix
Replace `--outfile` with `--outdir`, then rename the emitted entry bundle to `server-node.mjs` before the existing perl substitutions and polyfill-header injection run. All downstream steps are unchanged.
```diff
--external playwright
...
+mv "$DIST_DIR/server.js" "$DIST_DIR/server-node.mjs"
```
The ngrok native asset lands in `dist/` as a sibling file; `browse.exe` doesn't reference it, and it's already covered by the existing `browse/dist/` line in `.gitignore`, so it won't get committed.
Verification
Verified end-to-end on Windows 11 / Bun v1.3.11:
No changes needed to `package.json`, `setup`, or any caller — the script is the only thing that had to change.
Not in scope