-
-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Following React Native docs does not work and Property 'TransformStream' doesn't exist on React Native (runtime) #2367
Comments
Hi, @lgibso34. Thanks for reporting this! We should introduce a separate export condition for This is a pull request for https://github.com/mswjs/interceptors. |
Do you know if there's a list of all global APIs in React Native? I doubt there's |
I do not, sorry. Thanks for responding though and taking a look. |
@kettanaito I'm sure I'm doing something wrong but I tried to comment out this line or well changed it do |
Found a workaround it looks like this polyfill can get things working for the time being if you add it to your msw.polyfill.js file. https://github.com/MattiasBuelens/web-streams-polyfill Edit: Spoke too soon it did get me past the TransformStream issue but now I'm seeing something about MessageEvent. |
Is there a version of MSW where this is not an issue? |
Sadly, what ended up working for me is downgrading msw to 2.4.11 I followed the documentation and also installed jest-fixed-jsdom as @kettanaito suggested in the other issue, and I'm still getting problems, I even started to add this libraries to the polyfill but keep getting different compilation errors. |
Any movement on this? Seems like a pretty critical issue - can't use with React Native at all.. |
Prerequisites
Environment check
msw
versionNode.js version
v18.15.0
Reproduction repository
https://github.com/lgibso34/react-native-msw
Reproduction steps
Similar to #2344 but not Jest related.
main
branchTransformStream error
1.
git checkout bug/sync
2. npm start
3. launch on device
Current behavior
Bug 1: Seems that React Native does not support the dynamic import syntax and fails to register the component in time.
Bug 2: Property 'TransformStream' doesn't exist on React Native at runtime running the synchronous code. This would also occur if the async version (bug 1) worked
Expected behavior
Bug 1: I expect the docs to explain how to get this working with additional metro config or a complete example with Metro and RN CLI. I expect the docs to accurately describe how to get msw to work in React Native.
Bug 2: I expect this to work on React Native like the docs suggest.
Async error (main)
Sync error (bug/sync)
The text was updated successfully, but these errors were encountered: