Skip to content

chore(sdk): drop node-fetch fallback and optional peer dependency - #4866

Merged
2heal1 merged 2 commits into
module-federation:mainfrom
gu-stav:drop-node-fetch-sdk
Jul 7, 2026
Merged

2heal1 merged 2 commits into
module-federation:mainfrom
gu-stav:drop-node-fetch-sdk

Conversation

@gu-stav

@gu-stav gu-stav commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

The sdk only reached for node-fetch when global fetch was missing — Node ≤ 17, all EOL. And on those versions the fallback was already half-broken: lazyLoaderHookFetch checks res instanceof Response against the global Response, which doesn't exist without native fetch, so the loader-hook path threw before node-fetch ever got a chance.

Native fetch was 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

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the documentation.

@changeset-bot

changeset-bot Bot commented Jul 2, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d7f4d47

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 47 packages
Name Type
@module-federation/sdk Major
@module-federation/devtools Major
@module-federation/cli Major
@module-federation/dts-plugin Major
@module-federation/enhanced Major
@module-federation/esbuild Patch
@module-federation/managers Major
@module-federation/manifest Major
@module-federation/metro Major
@module-federation/modern-js-v3 Major
@module-federation/modern-js Major
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/observability-plugin Patch
@module-federation/retry-plugin Major
@module-federation/rsbuild-plugin Major
@module-federation/rspack Major
@module-federation/rspress-plugin Major
@module-federation/runtime-core Major
@module-federation/runtime Major
@module-federation/storybook-addon Major
@module-federation/utilities Patch
@module-federation/webpack-bundler-runtime Major
@module-federation/bridge-react-webpack-plugin Major
@module-federation/bridge-react Major
@module-federation/bridge-vue3 Major
shared-tree-shaking-no-server-host Patch
shared-tree-shaking-no-server-provider Patch
@module-federation/metro-plugin-rnc-cli Major
@module-federation/metro-plugin-rnef Major
@module-federation/metro-plugin-rock Major
shared-tree-shaking-with-server-host Patch
shared-tree-shaking-with-server-provider Patch
node-dynamic-remote-new-version Patch
node-dynamic-remote Patch
@module-federation/playground Patch
remote5 Patch
remote6 Patch
website-new Patch
@module-federation/runtime-tools Major
@module-federation/inject-external-runtime-core-plugin Major
@module-federation/third-party-dts-extractor Major
@module-federation/bridge-shared Major
@module-federation/error-codes Major
create-module-federation Major
@module-federation/treeshake-server Major
@module-federation/treeshake-frontend Major

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

@netlify

netlify Bot commented Jul 2, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit d7f4d47
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/6a4b60ce9e0e3a00091faeee
😎 Deploy Preview https://deploy-preview-4866--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread packages/sdk/src/node.ts
}

return typeof fetch === 'undefined' ? loadNodeFetch() : fetch;
return fetch;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@gu-stav
gu-stav force-pushed the drop-node-fetch-sdk branch 2 times, most recently from 4c19855 to ee6b8ec Compare July 2, 2026 11:16
@pkg-pr-new

pkg-pr-new Bot commented Jul 6, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@module-federation/devtools

pnpm add https://pkg.pr.new/@module-federation/devtools@d7f4d47

@module-federation/cli

pnpm add https://pkg.pr.new/@module-federation/cli@d7f4d47

create-module-federation

pnpm add https://pkg.pr.new/create-module-federation@d7f4d47

@module-federation/dts-plugin

pnpm add https://pkg.pr.new/@module-federation/dts-plugin@d7f4d47

@module-federation/enhanced

pnpm add https://pkg.pr.new/@module-federation/enhanced@d7f4d47

@module-federation/error-codes

pnpm add https://pkg.pr.new/@module-federation/error-codes@d7f4d47

@module-federation/esbuild

pnpm add https://pkg.pr.new/@module-federation/esbuild@d7f4d47

@module-federation/managers

pnpm add https://pkg.pr.new/@module-federation/managers@d7f4d47

@module-federation/manifest

pnpm add https://pkg.pr.new/@module-federation/manifest@d7f4d47

@module-federation/metro

pnpm add https://pkg.pr.new/@module-federation/metro@d7f4d47

@module-federation/metro-plugin-rnc-cli

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnc-cli@d7f4d47

@module-federation/metro-plugin-rnef

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnef@d7f4d47

@module-federation/metro-plugin-rock

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rock@d7f4d47

@module-federation/modern-js

pnpm add https://pkg.pr.new/@module-federation/modern-js@d7f4d47

@module-federation/modern-js-v3

pnpm add https://pkg.pr.new/@module-federation/modern-js-v3@d7f4d47

@module-federation/native-federation-tests

pnpm add https://pkg.pr.new/@module-federation/native-federation-tests@d7f4d47

@module-federation/native-federation-typescript

pnpm add https://pkg.pr.new/@module-federation/native-federation-typescript@d7f4d47

@module-federation/nextjs-mf

pnpm add https://pkg.pr.new/@module-federation/nextjs-mf@d7f4d47

@module-federation/node

pnpm add https://pkg.pr.new/@module-federation/node@d7f4d47

@module-federation/observability-plugin

pnpm add https://pkg.pr.new/@module-federation/observability-plugin@d7f4d47

@module-federation/playground

pnpm add https://pkg.pr.new/@module-federation/playground@d7f4d47

@module-federation/retry-plugin

pnpm add https://pkg.pr.new/@module-federation/retry-plugin@d7f4d47

@module-federation/rsbuild-plugin

pnpm add https://pkg.pr.new/@module-federation/rsbuild-plugin@d7f4d47

@module-federation/rspack

pnpm add https://pkg.pr.new/@module-federation/rspack@d7f4d47

@module-federation/rspress-plugin

pnpm add https://pkg.pr.new/@module-federation/rspress-plugin@d7f4d47

@module-federation/runtime

pnpm add https://pkg.pr.new/@module-federation/runtime@d7f4d47

@module-federation/runtime-core

pnpm add https://pkg.pr.new/@module-federation/runtime-core@d7f4d47

@module-federation/runtime-tools

pnpm add https://pkg.pr.new/@module-federation/runtime-tools@d7f4d47

@module-federation/sdk

pnpm add https://pkg.pr.new/@module-federation/sdk@d7f4d47

@module-federation/storybook-addon

pnpm add https://pkg.pr.new/@module-federation/storybook-addon@d7f4d47

@module-federation/third-party-dts-extractor

pnpm add https://pkg.pr.new/@module-federation/third-party-dts-extractor@d7f4d47

@module-federation/treeshake-frontend

pnpm add https://pkg.pr.new/@module-federation/treeshake-frontend@d7f4d47

@module-federation/treeshake-server

pnpm add https://pkg.pr.new/@module-federation/treeshake-server@d7f4d47

@module-federation/typescript

pnpm add https://pkg.pr.new/@module-federation/typescript@d7f4d47

@module-federation/utilities

pnpm add https://pkg.pr.new/@module-federation/utilities@d7f4d47

@module-federation/webpack-bundler-runtime

pnpm add https://pkg.pr.new/@module-federation/webpack-bundler-runtime@d7f4d47

@module-federation/bridge-react

pnpm add https://pkg.pr.new/@module-federation/bridge-react@d7f4d47

@module-federation/bridge-react-webpack-plugin

pnpm add https://pkg.pr.new/@module-federation/bridge-react-webpack-plugin@d7f4d47

@module-federation/bridge-shared

pnpm add https://pkg.pr.new/@module-federation/bridge-shared@d7f4d47

@module-federation/bridge-vue3

pnpm add https://pkg.pr.new/@module-federation/bridge-vue3@d7f4d47

@module-federation/inject-external-runtime-core-plugin

pnpm add https://pkg.pr.new/@module-federation/inject-external-runtime-core-plugin@d7f4d47

commit: d7f4d47

@github-actions

github-actions Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Bundle Size Report

15 package(s) changed, 27 unchanged.

Package dist + ESM entry

Package Total dist (raw) Delta ESM gzip Delta
@module-federation/bridge-react 383.9 kB -500 B (-0.1%) 1.3 kB no change
@module-federation/bridge-vue3 175.7 kB -262 B (-0.1%) 25.7 kB -42 B (-0.2%)
@module-federation/cli 26.3 kB no change 786 B no change
@module-federation/core 39.1 kB no change 173 B no change
@module-federation/devtools 668.2 kB no change 4.0 kB no change
@module-federation/enhanced 810.0 kB no change 672 B no change
@module-federation/inject-external-runtime-core-plugin 5.2 kB -26 B (-0.5%) 520 B no change
@module-federation/managers 70.0 kB no change 334 B no change
@module-federation/manifest 136.1 kB no change 182 B no change
@module-federation/metro-plugin-rnc-cli 0 B no change 314 B no change
@module-federation/node 193.4 kB no change 217 B no change
@module-federation/playground 28.84 MB -2872 B (-0.0%) 51.8 kB -52 B (-0.1%)
@module-federation/sdk 128.5 kB -496 B (-0.4%) 785 B no change
@module-federation/storybook-addon 79.2 kB no change 100 B no change
@module-federation/utilities 110.6 kB no change 328 B no change

Bundle targets

Package Web bundle (gzip) Delta Node bundle (gzip) Delta
@module-federation/bridge-react 17.9 kB no change 18.9 kB -35 B (-0.2%)
@module-federation/bridge-vue3 19.0 kB no change 19.2 kB -36 B (-0.2%)
@module-federation/cli 2.3 kB -34 B (-1.4%) 2.3 kB -34 B (-1.4%)
@module-federation/core 1.1 kB -33 B (-2.9%) 1.0 kB -31 B (-2.9%)
@module-federation/devtools 30.4 kB -33 B (-0.1%) 30.4 kB -33 B (-0.1%)
@module-federation/enhanced 2.6 kB -45 B (-1.6%) 2.6 kB -45 B (-1.6%)
@module-federation/inject-external-runtime-core-plugin 396 B no change 396 B no change
@module-federation/managers 2.4 kB -27 B (-1.1%) 2.4 kB -27 B (-1.1%)
@module-federation/manifest 6.1 kB -41 B (-0.7%) 6.1 kB -41 B (-0.7%)
@module-federation/metro-plugin-rnc-cli 411 B -26 B (-5.9%) 411 B -26 B (-5.9%)
@module-federation/node 9.2 kB -29 B (-0.3%) 9.2 kB -29 B (-0.3%)
@module-federation/playground 48.0 kB -54 B (-0.1%) 48.0 kB -54 B (-0.1%)
@module-federation/sdk 4.5 kB no change 5.9 kB -33 B (-0.5%)
@module-federation/storybook-addon 1.9 kB -25 B (-1.3%) 1.7 kB -24 B (-1.3%)
@module-federation/utilities 2.6 kB -33 B (-1.2%) 2.6 kB -33 B (-1.2%)

Consumer scenarios

Scenario Web output (gzip) Delta Node output (gzip) Delta Gap (node-web) Delta
Enhanced remoteEntry 21.4 kB -23 B (-0.1%) 23.0 kB -68 B (-0.3%) +1.6 kB -45 B

Total dist (raw): 35.70 MB (-4156 B (-0.0%))
Total ESM gzip: 131.1 kB (-94 B (-0.1%))
Total web bundle (gzip): 255.4 kB (-380 B (-0.1%))
Total node bundle (gzip): 257.6 kB (-481 B (-0.2%))
Tracked ./bundler entry gzip: 556 B (no change)
Tracked ./bundler web bundle (gzip): 4.8 kB (no change)
Tracked ./bundler node bundle (gzip): 4.8 kB (no change)

Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as ./bundler are measured separately so ENV_TARGET-driven tree-shaking is visible. Bare imports are externalized to keep package-level sizes consistent, and assets are emitted as resources.

@gu-stav
gu-stav force-pushed the drop-node-fetch-sdk branch from 554e212 to 71eb1fc Compare July 6, 2026 06:56
@2heal1
2heal1 merged commit dcc640b into module-federation:main Jul 7, 2026
23 checks passed
@2heal1 2heal1 mentioned this pull request Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants