Skip to content

Expo / React Native not having support for 'events' #1847

@thomasgrivet

Description

@thomasgrivet

Prerequisites

Environment check

  • I'm using the latest msw version
  • I'm using Node.js version 18 or higher

Node.js version

21.1.0

Reproduction repository

https://github.com/Cocolis-1/blank-expo/tree/feat/msw

Reproduction steps

Try to start the bundler using yarn start and start your dev client.

Current behavior

You should see the following error:

iOS Bundling failed
The package at "node_modules/msw/lib/native/index.js" attempted to import the Node standard library module "events".
It failed because the native React runtime does not include the Node standard library.
Learn more: https://docs.expo.dev/workflow/using-libraries/#using-third-party-libraries

Expected behavior

MSW should not depend on node:events (if possible) so that React Native users can use it.
I think the commit introducing node:events is this one.
Let me know if I can help in any way!

Thanks!

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingneeds:triageIssues that have not been investigated yet.scope:nodeRelated to MSW running in Node

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions