Repository navigation
chore(sdk): drop node-fetch fallback and optional peer dependency - #4866
Conversation
🦋 Changeset detectedLatest commit: d7f4d47 The changes in this PR will be included in the next version bump. This PR includes changesets to release 47 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6eb979ae0b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } | ||
|
|
||
| return typeof fetch === 'undefined' ? loadNodeFetch() : fetch; | ||
| return fetch; |
There was a problem hiding this comment.
Keep a fallback while SDK has no Node engine floor
This now reads the global fetch unconditionally. @module-federation/sdk still publishes without an engines floor, and packages such as @module-federation/rsbuild-plugin still advertise Node >=16.0.0, so Node 16/17 consumers can install these packages even though they do not have globalThis.fetch; any SSR/node remote that calls loadScriptNode/createScriptNode will reject with ReferenceError: fetch is not defined instead of using the optional node-fetch path. Either keep the dynamic fallback for those installs or make the Node >=18/20 requirement explicit and release it as a breaking change.
Useful? React with 👍 / 👎.
4c19855 to
ee6b8ec
Compare
@module-federation/devtools
@module-federation/cli
create-module-federation
@module-federation/dts-plugin
@module-federation/enhanced
@module-federation/error-codes
@module-federation/esbuild
@module-federation/managers
@module-federation/manifest
@module-federation/metro
@module-federation/metro-plugin-rnc-cli
@module-federation/metro-plugin-rnef
@module-federation/metro-plugin-rock
@module-federation/modern-js
@module-federation/modern-js-v3
@module-federation/native-federation-tests
@module-federation/native-federation-typescript
@module-federation/nextjs-mf
@module-federation/node
@module-federation/observability-plugin
@module-federation/playground
@module-federation/retry-plugin
@module-federation/rsbuild-plugin
@module-federation/rspack
@module-federation/rspress-plugin
@module-federation/runtime
@module-federation/runtime-core
@module-federation/runtime-tools
@module-federation/sdk
@module-federation/storybook-addon
@module-federation/third-party-dts-extractor
@module-federation/treeshake-frontend
@module-federation/treeshake-server
@module-federation/typescript
@module-federation/utilities
@module-federation/webpack-bundler-runtime
@module-federation/bridge-react
@module-federation/bridge-react-webpack-plugin
@module-federation/bridge-shared
@module-federation/bridge-vue3
@module-federation/inject-external-runtime-core-plugin
commit: |
Bundle Size Report15 package(s) changed, 27 unchanged. Package dist + ESM entry
Bundle targets
Consumer scenarios
Total dist (raw): 35.70 MB (-4156 B (-0.0%)) Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as |
554e212 to
71eb1fc
Compare
Description
The sdk only reached for
node-fetchwhen globalfetchwas missing — Node ≤ 17, all EOL. And on those versions the fallback was already half-broken:lazyLoaderHookFetchchecksres instanceof Responseagainst the globalResponse, which doesn't exist without native fetch, so the loader-hook path threw beforenode-fetchever got a chance.Native
fetchwas already preferred everywhere it exists, so behavior on any supported Node doesn't change.Related Issue
No open issue — continuation of the dependency slimming in #4775.
Types of changes
Checklist