Skip to content

feat: prefer global fetch on Node.js#20

Merged
ChALkeR merged 1 commit into
masterfrom
chalker/prefer-global-fetch
Aug 3, 2024
Merged

feat: prefer global fetch on Node.js#20
ChALkeR merged 1 commit into
masterfrom
chalker/prefer-global-fetch

Conversation

@ChALkeR
Copy link
Copy Markdown
Contributor

@ChALkeR ChALkeR commented Aug 3, 2024

Native fetch is no longer behind the experimental flag since Node.js 18.0.0, and is marked stable since Node.js 21.0.0
And the current impl in v20.11+ is newer then the one in v21.0.0

This leaves the backwards-compat in place with environments with no global fetch, and only prefers it over node-fetch

We can remove node-fetch fallback in v2 or v1 as we don't really need it anymore and all supported Node.js versions have global fetch

@ChALkeR ChALkeR requested review from feri42 and mvayngrib August 3, 2024 12:06
Copy link
Copy Markdown

@mvayngrib mvayngrib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

this seems like a potentially breaking change, no? Or does node-fetch also use global fetch underneath if it's available?

Comment thread fetch.js
@ChALkeR
Copy link
Copy Markdown
Contributor Author

ChALkeR commented Aug 3, 2024

@mvayngrib

this seems like a potentially breaking change, no?

It is, technically

Or does node-fetch also use global fetch underneath if it's available

No

Clients should expect to be compatible with browser/global fetch already though, as they are used in different envs
So I wouldn't count this as a major breaking change, just as a semver-minor, to not cause extra update churn

Also, this can be overriden in specific setups

@ChALkeR ChALkeR merged commit be4f900 into master Aug 3, 2024
@ChALkeR ChALkeR deleted the chalker/prefer-global-fetch branch August 3, 2024 12:42
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Aug 3, 2024

🎉 This PR is included in version 1.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants