Skip to content

Revert chokidar to ^4.0.3 in react-native-session-replay#1319

Open
jonathanmos wants to merge 1 commit into
developfrom
jmoskovich/revert-sr-chokidar
Open

Revert chokidar to ^4.0.3 in react-native-session-replay#1319
jonathanmos wants to merge 1 commit into
developfrom
jmoskovich/revert-sr-chokidar

Conversation

@jonathanmos

Copy link
Copy Markdown
Member

What does this PR do?

Reverts chokidar in @datadog/mobile-react-native-session-replay from ^5.0.0 back to ^4.0.3.
this change

Motivation

chokidar was bumped to ^5.0.0 as part of a broad, unrelated dependency-bump commit ("Update dependencies across packages"), replacing the ^4.0.3 pin the SVG asset-bundler Metro plugin was originally built and tested against.

chokidar 5.x is a pure ESM package with no CommonJS require export condition. The Metro plugin (withSessionReplayAssetBundler) is consumed via require() from a CommonJS entry point (metro.js → compiled metro/index.js), which throws ERR_REQUIRE_ESM the moment chokidar resolves to v5 — on any Node version below ~20.19 (the version where Node added synchronous require() support for ESM-only packages).

Since this SDK doesn't declare its own engines.node floor, and React Native itself didn't raise its own Node requirement to >=20.19.4 until RN 0.81 (Aug 2025), any consumer still on RN ≤0.80 building with Node 18/19 hits a crash the moment they wire up the plugin as documented in the README — before Metro even boots.

^4.0.3 is a dual CJS/ESM package (proper require export condition) with a Node >=14.16 floor, so it fixes this without requiring any Node or RN upgrade.

Additional Notes

Anything else we should know when reviewing?

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

@jonathanmos jonathanmos marked this pull request as ready for review July 2, 2026 13:13
@jonathanmos jonathanmos requested a review from a team as a code owner July 2, 2026 13:13
Copilot AI review requested due to automatic review settings July 2, 2026 13:13

Copilot AI 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.

Pull request overview

This PR reverts the chokidar dependency used by @datadog/mobile-react-native-session-replay back to the 4.x line to avoid CommonJS require() failures caused by chokidar@5 being ESM-only, restoring compatibility for consumers on older Node/RN combinations.

Changes:

  • Downgrade chokidar in packages/react-native-session-replay from ^5.0.0 to ^4.0.3.
  • Update yarn.lock to resolve chokidar@4.0.3 (and readdirp@^4.0.1) instead of the prior 5.x chain.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
packages/react-native-session-replay/package.json Reverts chokidar dependency to ^4.0.3 for CJS compatibility in the Metro plugin use case.
yarn.lock Updates lock entries to resolve chokidar@4.0.3 (and compatible readdirp) and removes the chokidar@5 resolution for this range.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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