Closed mcollina closed 3 years ago
Do you imagine we do that by excluding web streams? i.e. we just work on async iterables?
Also node-fetch moved to ESM breaking everybody
Ref?
From their readme https://github.com/node-fetch/node-fetch/blob/main/README.md:
node-fetch is an ESM-only module - you are not able to import it with require. We recommend you stay on v2 which is built with CommonJS unless you use ESM yourself. We will continue to publish critical bug fixes for it.
I think just support async iterators for v12 and v14 would be fine. Unless we can see to backport web streams to v14 at least and not support v12 for fetch.
ky-universal would really benefit from fetch()
in core supporting web streams back to Node 14.
To be honest I have a feeling that supporting lower versions than 16.x can end up being a blocker. If we encounter a bug that is Node.js v14-specific, patches will keep accumulating and it will be just harder to maintain. Once we reach stable I'm okay with supporting lower versions. Just my two cents.
This makes sense @szmarczak! I'll close this for now - we might reevaluate when/if Node.js v14 ships Web Streams.
I don't know much about undici and I'm interested in this. Are the availability of web streams the only thing that prevents fetch from working under Node 14? If so, can I just shim them and use it on 14 anyway?
You can either shim web streams and/or add an option where node streams are used instead of web streams.
Maybe you/we could use https://www.npmjs.com/package/web-streams-polyfill?
and/or add an option where node streams are used instead of web streams
You mean PR against undici? Does this have a chance of getting merged?
and/or add an option where node streams are used instead of web streams
You mean PR against undici? Does this have a chance of getting merged?
I'd say 50/50
At random? If I should contribute this, it helps to know what a successful merge depends on.
I think it would significantly benefit adoption of undici and standard fetch in Node.js.
Also node-fetch moved to ESM breaking everybody, so there is definitely a way to encourage migration.