Chore - drop node-fetch in favor of global fetch - #200
Merged
Merged
Conversation
`node-fetch` was imported in a single file (js/AudioWorklet.js) to load worklet modules from http(s) URLs. Node has shipped a global `fetch` since v18, and package.json already requires `node >= 22`, so the import is dead weight: removing it leaves the two call sites unchanged. This drops 5 packages from every install (node-fetch, fetch-blob, formdata-polyfill, data-uri-to-buffer, node-domexception), one of which (node-domexception) is deprecated and prints an install-time warning.
wine-fall
force-pushed
the
chore/drop-node-fetch
branch
from
September 14, 2026 05:49
08a977b to
650dcf4
Compare
Collaborator
|
Hey, Thanks for the fix! (I checked wpt, no problem) |
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.
What
node-fetchis imported in exactly one place —js/AudioWorklet.js— to load worklet modules fromhttp(s)URLs:Node has shipped a global
fetchsince v18, andpackage.jsonalready declares"engines": { "node": ">= 22" }— so the import is dead weight. This PR deletes it and removes the dependency. The two call sites are unchanged; nothing else in the diff.Why
It removes 5 packages from every install of
node-web-audio-api:node-domexception@1.0.0is deprecated upstream ("Use your platform's native DOMException instead"), so everynpm iof a package that depends on this one prints a deprecation warning that the user can do nothing about. That is how I found it — it shows up when installing my own project.Behaviour
Both call sites already wrap the fetch in
try/catchand rethrow aDOMException('...', 'AbortError'), so the difference in error shape betweennode-fetchand undici'sfetchis not observable to callers. Rejection on network failure andres.text()behave the same.Testing
node --check js/AudioWorklet.jspasses, and I read every reference to confirm line 17 was the only one (grep -rn node-fetchover the tree is now empty). I did not run the WPT suite locally — that needs a full Rust build of the native module on my machine — so I'm relying on CI here. Happy to adjust if something in the worklet tests disagrees.