Skip to content

fix(webrtc)!: make React Native WebRTC an optional peer - #3657

Merged
tabcat merged 4 commits into
libp2p:mainfrom
w3lld1:fix/webrtc-optional-react-native-peer
Oct 10, 2026
Merged

tabcat merged 4 commits into
libp2p:mainfrom
w3lld1:fix/webrtc-optional-react-native-peer

Conversation

@w3lld1

@w3lld1 w3lld1 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Description

I moved react-native-webrtc from a runtime dependency to an optional peer, keeping the same version range and a development dependency so the React Native entry point remains available during development. Node.js and browser consumers no longer need to resolve the React Native/Metro subtree.

I documented the explicit React Native installation step in the package documentation and regenerated the README. I added a Node-only regression test for the dependency contract, including the optional peer metadata, development version range, and existing React Native entry-point mapping. The transport runtime is unchanged.

Fixes #3609

BREAKING CHANGE: React Native applications must explicitly install react-native-webrtc@^124.0.6 alongside @libp2p/webrtc; it is no longer installed transitively.

Notes & open questions

I checked this with Node.js 22.23.1 and npm 10.9.8:

  • npx eslint src/index.ts test/node.ts — passed.
  • npx mocha test/node.ts --timeout 60000 — 1 passing. The same test fails against the upstream package manifest because react-native-webrtc is a regular dependency.
  • npm run dep-check in packages/transport-webrtc — passed.
  • npx aegir docs --publish false -- --skipErrorChecking — generated the package README; this is documentation generation, not a TypeScript validation result.
  • git diff --check — passed.
  • I compared isolated npm consumer lockfiles for the upstream manifest and the modified package tarball using npm pack --ignore-scripts --json and default peer resolution with npm install --package-lock-only --ignore-scripts --no-audit --no-fund. The upstream manifest produced 328 lockfile entries including React Native/Metro; the patched tarball produced 104 entries, with no react-native-webrtc, react-native, @react-native/*, Metro, or image-size. This checks dependency resolution, not native execution.

I am leaving the full monorepo build and transport/platform suites to CI. My full build did not complete. The subsequent project-reference TypeScript build and documentation checks were blocked by missing built workspace packages (including @libp2p/gossipsub and @libp2p/noise), so I am not reporting the complete npm run lint or full test suite as passing. I have not tested a React Native application.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

BREAKING CHANGE: React Native applications must install react-native-webrtc explicitly alongside @libp2p/webrtc.
@w3lld1
w3lld1 requested a review from a team as a code owner October 10, 2026 10:29
The linked Documentation/GettingStarted.md does not exist, point at the README section instead.
The escape is not needed inside a code fence and rendered literally.
It only restated the manifest and would fail on dev-only dependency bumps.
@tabcat tabcat changed the title fix(webrtc)!: make React Native WebRTC an optional peer fix(webrtc): make React Native WebRTC an optional peer Oct 10, 2026
@tabcat tabcat changed the title fix(webrtc): make React Native WebRTC an optional peer fix(webrtc)!: make React Native WebRTC an optional peer Oct 10, 2026
@tabcat

tabcat commented Oct 10, 2026

Copy link
Copy Markdown
Member

Thanks!

@tabcat
tabcat merged commit 5c4cdb2 into libp2p:main Oct 10, 2026
36 checks passed
@tabcat tabcat mentioned this pull request Oct 10, 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.

webrtc: react-native-webrtc as a regular dependency pulls react-native and metro into every Node.js install

2 participants