fix(build): externalize socks + sharp in node-server bundle (Bun on Windows)#2260
fix(build): externalize socks + sharp in node-server bundle (Bun on Windows)#2260Spooks444 wants to merge 3 commits into
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
CI / verify noteThis PR fixes a Windows What was verified
Not verifiable in the author's sandbox (environmental, not a defect)
How a maintainer can re-confirm on a networked runner |
Bun's bundler refused to inline socks and sharp (both ship .node native addons), so the Windows node-server build failed with 'Could not resolve: socks / sharp'. Added --external socks and --external sharp to browse/scripts/build-node-server.sh, matching the script's own documented rule for .node-addon deps. Verified: bash build-node-server.sh -> exit 0, emits server-node.mjs; bun run build -> exit 0 (all 6 artifacts compile).
- convert bun build paths to Windows-native via cygpath so the bundle actually lands on disk when MSYS_NO_PATHCONV is set - make Step 3 compat-header injection idempotent (no re-duplicate on rebuild) - drop the duplicate createRequire import (reuse bundle's own) to fix 'Identifier createRequire has already been declared' on Node 25
build-node-server.sh only produces server-node.mjs (the Node.js server bundle). The runnable 'browse' executable is a *compiled* artifact from scripts/build.sh (bun build --compile) and is gitignored, so a bare 'rm -rf browse/dist' can leave a valid server bundle with no CLI binary. Add a Step 5 that detects the missing binary and prints remediation instead of failing later with a cryptic ENOENT.
CI / verify note (updated 2026-07-15)This PR fixes a Windows What was verified
Not verifiable in the author's sandbox (environmental, not a defect)
Previous "network requirement" caveat is WITHDRAWNAn earlier note suggested How a maintainer can re-confirm on a networked runnerbun run build # full build incl. compiled 'browse' binary
node --check browse/dist/server-node.mjs
./browse/dist/browse goto https://example.com # needs outbound network |
|
Ready for review / merge. Branch is rebased onto current |
Summary
On Windows,
bun run build(viasetup) failed at the Node server bundle step (browse/scripts/build-node-server.sh). Bun's bundler refuses to inline the native.nodeaddonssocksandsharp, aborting the whole build.This marks
socksandsharpas--externalso the bundle emits a validserver-node.mjswithout inlining native modules. The runtime resolves them fromnode_modulesnormally.Verification
bash browse/scripts/build-node-server.sh→SCRIPT_EXIT=0, emitsbrowse/dist/server-node.mjs(≈498 KB)bun run build(full, what./setupruns) →BUILD_EXIT=0, all 6 artifacts compilenode --check browse/dist/server-node.mjs→SYNTAX_OKNotes
Spooks444/gstackfork per contributor's push policy (does not target upstream directly).🤖 Generated with Hermes Agent