Repository navigation
Declare event-target-shim as a dependency (missing on React Native 0.80+) - #118
Open
andrejtomic wants to merge 1 commit into
Open
andrejtomic wants to merge 1 commit into
andrejtomic wants to merge 1 commit into
Conversation
EventSourceBase requires event-target-shim, but the package did not declare it and relied on react-native's transitive copy. React Native stopped depending on event-target-shim in 0.80, so on 0.80+ apps the module only resolves by accident (or not at all), and Metro fails with "Unable to resolve module event-target-shim". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
React Native SDK
What did you accomplish?
src/platform/EventSource/EventSourceBase.tsdoesrequire('event-target-shim'), but the package doesn't declareevent-target-shimas a dependency. It has only resolved becausereact-nativedepended on it (^5.0.1) and package managers hoisted that copy.react-nativedropped that dependency in 0.80 (0.79 is the last version that has it). On 0.80+ the module is missing unless something else happens to pull it in, and Metro fails withUnable to resolve module event-target-shimwhen it bundles the EventSource polyfill.event-target-shim@^5.0.1independencies, the same range React Native used. The code uses v5's default-exportEventTargetclass, so 6.x is out of scope. The lockfile only adds the specifier and dropsdev: truefrom the entry that was already there. The resolved version doesn't change.// Package included by react-nativecomment.How do we test the changes introduced in this PR?
Reproduce on
development/ 1.5.0 from npm:With this branch,
event-target-shimgets installed alongside the SDK and resolves.npm run check,npm testandnpm run buildpass.Extra Notes
react-native@0.72, which still bringsevent-target-shimin, so a test here would pass with or without the fix.CHANGES.txtso it won't conflict with the open release PR (Prepare release v1.6.0 #115). A suggested entry:Bugfix - Declared event-target-shim as a dependency, required by the EventSource polyfill, since React Native 0.80+ no longer provides it.