Skip to content

Avoid mutating global fetch in Node.js - #121

Open
compxed wants to merge 1 commit into
nmrugg:masterfrom
compxed:fix/node-global-fetch
Open

compxed wants to merge 1 commit into
nmrugg:masterfrom
compxed:fix/node-global-fetch

Conversation

@compxed

@compxed compxed commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • preserve Node's native global fetch
  • load the local WebAssembly binary without installing global shims
  • preserve a preassembled wasmBinary
  • add a regression test

Testing

Closes #119

@compxed

compxed commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Related: this also covers the Node 18 local-WASM loading problem reported in #64. I reproduced the original failure with Stockfish.js 15 on Node 18.19.1. Current master already works with the normal string path because of the global fetch/XMLHttpRequest workaround that this PR replaces; the PR version preserves that behavior while keeping native fetch intact and leaving globalThis.XMLHttpRequest untouched. The pathToFileURL() workaround shown in #64 is no longer needed.

@compxed
compxed force-pushed the fix/node-global-fetch branch from 9691f37 to 653b70e Compare October 12, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

initEngine() (Node) silently clobbers globalThis.fetch

1 participant