-
Notifications
You must be signed in to change notification settings - Fork 272
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
Expo managed workflow - crash on web #917
Comments
What are the errors? Please share a github repo that we can use to test this |
|
Here's a sample repo https://github.com/nzhenry/stripe-expo-web-sample |
There seem to be other errors besides stripe-react-native, are those expected for you? |
No. All the errors were introduced when I added the Stripe library. |
Gotchya, we probably just need to stub out almost-empty .web files |
I've just ran into the same issue, would be nice to see those stubbing web files added :) |
@olaurendeau I have a workaround for now. I've implemented separate application entry points for mobile and web, with a basic dependency injection container to abstract away the platform dependent components. It's not ideal, but it works. |
I'm facing only this error:
|
|
Hi Any Ideas to solve the question? I facing this problem too |
I am still working through the first web build of my app but I seem to have got round this particular error for the meantime by adding null-loader as an alias for @stripe/stripe-react-native in my webpack config. I added a webpack.config.js as described here and then modified it so it looks like this excerpt. I also installed the null-loader package.
|
Let me make the steps explicit for the lazy folks like future me. (All credits to @robert-nash , in his previous answer.)
|
Facing this issue too, the fix posted by @robert-nash / @MehmetKaplan is not working for me. |
I'm also having this issue. |
facing same error |
For me this was caused by |
facing same issue.The fixes above are not working for me. Anybody else have any ideas how to resolve this issue? |
Did you fix it mate ? |
|
I managed to solve this by using Platform extensions. I created a file |
This is seriously still an issue... |
I've asked the devs who maintain expo as well for guidance on this as I'm also running into this issue https://x.com/paulwaweruco/status/1797291557617340591
@JorensM I've tried your solution. I've got a I then import both files in a
I'm still running into the same error:
Is there something we might be missing? |
Any chance you can share what the stripe.ts and stripe.native.ts looks like and how its used when importing? |
A workaround(This is not the exact solution you are looking for.) I made a library that unifies web's and react-native's web-views. Using it, you can use the web version. The library is react-native-webview-with-web, (naming is hard). And using this I made another library, tamed-stripe which covers end to end whole structure (including a backend that answers the webhooks also). If specs are suitable (Postgresql, node.js backend, etc), it covers mostly used functions and as stated above paragraph it uses the web version of Stripe screens. It also has an example application with node.js backend and Expo frontend here. |
Sorry for the late response. When you make For clarity, here are my files:
Then you just import the Sorry if this is confusing, if so let me know and I'll try to clarify. |
Awesome, thank you @JorensM ! I've written up a blog post to expand on this further, let me know if you have any questions |
Hi @paulmbw please upload the project that you have create in the above blog...... |
You should have been able to access the project linked in the blog |
Thanks alot @paulmbw |
How do you do this? I am facing the same issue, it's weird these issues were reported back in 2022 and in 2024 the same issues persist. |
New solution works, but lazy TL;DR for anyone facing the problem on Expo Web (since webpack doesn't seem to be supported anymore):
Preferably for a larger project, you might want to abstract out your Stripe functions instead, then make components that return the exact functionality (on mobile) or a dummied out function( on web), instead of maintaining two identical versions of your pages. Relevant documentation on platform specific extensions here: https://docs.expo.dev/router/advanced/platform-specific-modules/#platform-specific-extensions |
hello! so, if i've understood correctly, we need 2 separate libraries, stripe-react-native for ios and android and stripe-js for web? thanks |
I resolved this issue with the workaround I mentioned in my post above. The library contains everything in an opinionated way.
An end to end example app is here. Disclaimer: I implemented the mentioned libraries but the post is not to advertise them. Use them if and only if they address your concerns. |
Describe the bug
Importing dependencies from @stripe/stripe-react-native causes app to crash on Expo managed workflow - web.
To Reproduce
Steps to reproduce the behavior:
expo install @stripe/stripe-react-native
Expected behavior
No errors unless stripe components are actually used at runtime.
Additional context
I'm aware that web isn't supported, but it would be nice if it would at least build so I could run my app. I don't plan to render any stripe components in the browser at runtime. Currently I can't figure out a way to make Webpack exclude this dependency. Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: