First, this is awesome and congratulations! Second this sounds like a lot of work! Can you comment why was it so hard to add fetch to node, yet packages like “node-fetch” have existed for some time and seem to implement fetch rather easily? Only asking from a curiosity perspective.
node-fetch (which is great btw!) implements fetch "reasonably" as in stuff like `fetch('./foo').then(x => x.json())` works but it's very far from a "real" fetch.
Some people argued users would still like it and there was an attempt[1] by Myles but at the end of the day - the changes were pretty big.
For example: a response body in fetch is a web stream (a whole new stream type) and to cancel you use an AbortController (web type) which is an EventTarget (another web type). `node-fetch` uses Node streams instead which is very reasonable but not something a platform can "get away" with while still calling it fetch.
Here is a comment I wrote about it in the tracker during the PR review process https://github.com/nodejs/node/pull/41749#issuecomment-10257...
THANKS!
Interesting! What CORS even means in server? Never thought about this. What's a server's origin to begin with?!
Then it took a while to get consensus it's fine to do even if we can't implement the standard fully and diverge from it on stuff like CORS (like Deno does).
Then there were a bunch of work adding APIs like `EventTarget` and `AbortSignal` to Node.js which are quirky'ish web APIs.
As a side note just to show positive collaboration: that work made me make maybe 10 PRs fixing things in EventTarget in Deno - and Deno helped Node a bunch now when landing fetch.
Then web streams and blobs and a few other things as well as the undici work in the background.
Then undici-fetch by Ethan, merge into Undici and then the PR by Michael - and it's still not done :)
Finally