Skip to content

Conversation

@yusinto
Copy link
Contributor

@yusinto yusinto commented Feb 7, 2024

This is a babel issue related to the event-target-shim package. For unknown reasons, in Expo 50, the metro bundler is unable to transpile event-target-shim correctly resulting in the error below.

ERROR  TypeError: Super expression must either be null or a function, js engine: hermes
...
info Opening .../node_modules/@launchdarkly/react-native-client-sdk/dist/src/polyfills/CustomEvent.js

Thankfully the event-target-shim package offers a transpiled es5 version which seems to work. We'll use that instead.

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #232716: Fix event-target-shim TypeError.

Comment on lines +26 to +30
"expo": "~50.0.6",
"expo-splash-screen": "~0.26.4",
"expo-status-bar": "~1.11.1",
"react": "18.2.0",
"react-native": "0.72.6",
"react-native": "0.73.4",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main changes are expo 50 and rn 0.73.

* https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Events/CustomEvent.js#L21
*/
import { Event } from 'event-target-shim';
import { Event } from 'event-target-shim/es5';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the babel TypeError.

@yusinto yusinto merged commit c1c0086 into main Feb 7, 2024
@yusinto yusinto deleted the yus/sc-232716/fix-event-target-shim-typeerror branch February 7, 2024 18:39
@github-actions github-actions bot mentioned this pull request Feb 7, 2024
yusinto pushed a commit that referenced this pull request Feb 7, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>js-client-sdk-common: 0.2.1</summary>

##
[0.2.1](js-client-sdk-common-v0.2.0...js-client-sdk-common-v0.2.1)
(2024-02-07)


### Bug Fixes

* Minor fixes from docs pr review.
([#363](#363))
([4768bf7](4768bf7))
</details>

<details><summary>react-native-client-sdk: 0.2.1</summary>

##
[0.2.1](react-native-client-sdk-v0.2.0...react-native-client-sdk-v0.2.1)
(2024-02-07)


### Bug Fixes

* Babel TypeError due to event-target-shim
([#365](#365))
([c1c0086](c1c0086))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-client-sdk-common bumped from 0.2.0 to 0.2.1
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

3 participants