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
Describe the bug
Since #4547,
@module-federation/sdkdeclaresnode-fetch: "^3.3.2"as a peerOptional dependency, while@module-federation/nodehard-depends onnode-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:Widening the SDK's peerOptional range from
"^3.3.2"to"^2.7.0 || ^3.3.2"would resolve this.Longer term, dropping
node-fetchentirely would also be an option, since Node 18+ has native fetch and all usage is behindtypeof fetch === 'undefined'guards (see #4620).Reproduction
npm install @module-federation/node@latestin a fresh project.Used Package Manager
npm
System Info