-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
gradio/client
does not work in non-node, non-browser environments - React native
#4348
Comments
this is also an issue if trying to use it in nextjs environment. . |
It works when you use it in the api folder |
Can you elaborate a bit about the fix, Please? for react native? |
The way I got around it was by creating a NextJS app to act as a middle man api that uses the @gradio/client library, to which I would send requests from the mobile app. The @gradio/client library seems to work just fine on NextJS and on other node based framework but not with expo. For now, this janky solution seems to work pretty well; if you are planning to create an api for your app that's the solution I suggest. Unfortunately I haven't found any other way around it :(. Best of luck to you! |
Thanks!!! |
gradio/client
does not work in non-node, non-browser environments - React native
@pngwn, did we close this issue because it's supposed to be fixed? As far as I see we still cannot call gradio api from the browser, we get
for |
The client definitely works in the browser as it powers the gradio frontend. Do you have a reproduction (including build step)? It could be an issue with how it is being bundled. |
@pngwn, thanks for a fast response. Steps to reproduce:
Result (first few errors, others are similar):
|
This is interesting. I can at least explain the purpose of those imports. The node built ins are imported by a dependency that we use to polyfill Websockets in node. However, that package is dynamically imported only in a node environment but it seems that esbuild does not like them. Ideally it should just leave them as external and not try to resolve them. I'll take a look and see if there is a way around it. Edit: for clarity we don't use websockets anymore but we keep this logic in for backwards compatibility reasons. |
One thing we could do is provide a dedicated browser build with its own export / entry point but the package is designed to be platform agnostic (as much as possible). |
For the time being at least, you can use the external option to ignore the node built ins: https://esbuild.github.io/api/#external |
@pngwn, thanks for a tip, adding the following to my esbuild config worked:
|
Describe the bug
After installing the @gradio/client package using
expo install @gradio/client
I get the following error:Is there an existing issue for this?
Reproduction
npm install -g expo-cli
expo init test-app
expo install @gradio/client
By following these steps you should end up getting the same error as me as seen in the screen shot below only I was using the ios simulator.
Screenshot
Logs
System Info
Severity
blocking all usage of gradio
The text was updated successfully, but these errors were encountered: