Skip to content

node-fetch version conflict between @module-federation/node and @module-federation/sdk #4624

@tuffz

Description

@tuffz

Describe the bug

Since #4547, @module-federation/sdk declares node-fetch: "^3.3.2" as a peerOptional dependency, while @module-federation/node hard-depends on node-fetch: "2.7.0".

When installing @module-federation/node, pnpm/npm resolves node-fetch@2.7.0 (from node's hard dependency), which doesn't satisfy sdk's peerOptional of ^3.3.2, producing:

npm warn Could not resolve dependency:
npm warn peerOptional node-fetch@"^3.3.2" from @module-federation/sdk@2.3.1

Widening the SDK's peerOptional range from "^3.3.2" to "^2.7.0 || ^3.3.2" would resolve this.

Longer term, dropping node-fetch entirely would also be an option, since Node 18+ has native fetch and all usage is behind typeof fetch === 'undefined' guards (see #4620).

Reproduction

npm install @module-federation/node@latest in a fresh project.

Used Package Manager

npm

System Info

System:
  OS: macOS
Binaries:
  Node: 20.19.2
  npm: 10.8.2
  pnpm: 10.28.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions