-
Notifications
You must be signed in to change notification settings - Fork 25k
refactor(dev-middleware): drop node-fetch in favor of Node built-in fetch
#45227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(dev-middleware): drop node-fetch in favor of Node built-in fetch
#45227
Conversation
node-fetch in favor of Node fetchnode-fetch in favor of Node built-in fetch
|
Why would it fail on |
Base commit: c7988c9 |
|
@robhogan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@byCedric if we use this with Node 18, or Node 20, do we get experimental API warnings? |
@NickGerleman No, there should not be any experimental warnings around
That warning was removed in Node 18.13.0, through PR 45287 |
|
This pull request was successfully merged by @byCedric in 30a3e6e. When will my fix make it into a release? | How to file a pick request? |
Summary: Removed `node-fetch` in favour of node builtin fetch to get rid of the deprecated `punycode` warning when using Node 22. `react-native/community-cli-plugin` already requires Node >= 18 where it was made available by default (without `--experimental-fetch` flag). This change is similar to the one made in #45227 ## Changelog: [GENERAL] [CHANGED] - Drop node-fetch in favor of Node's built-in fetch from undici in `react-native/community-cli-plugin` Pull Request resolved: #47397 Test Plan: tests pass Reviewed By: blakef Differential Revision: D66512595 Pulled By: NickGerleman fbshipit-source-id: c4e01baf388f9fae8cea7b4bfe25034bff28b461
Summary: Removed `node-fetch` in favour of node builtin fetch to get rid of the deprecated `punycode` warning when using Node 22. `react-native/community-cli-plugin` already requires Node >= 18 where it was made available by default (without `--experimental-fetch` flag). This change is similar to the one made in #45227 ## Changelog: [GENERAL] [CHANGED] - Drop node-fetch in favor of Node's built-in fetch from undici in `react-native/community-cli-plugin` Pull Request resolved: #47397 Test Plan: tests pass Reviewed By: blakef Differential Revision: D66512595 Pulled By: NickGerleman fbshipit-source-id: c4e01baf388f9fae8cea7b4bfe25034bff28b461



Summary:
Node 22 doesn't work well with
node-fetch@2, as one of their polyfills is using the deprecatedpunycodemodule. This causes unnecessary warnings like:Instead of upgrading to the much larger
node-fetch@3, this change dropsnode-fetchin favor of Node's own built-infetchimplementation (using undici).Changelog:
[GENERAL] [CHANGED] - Drop
node-fetchin favor of Node's built-in fetch fromundiciin@react-native/dev-middlewareTest Plan:
See CI for passing tests