-
Notifications
You must be signed in to change notification settings - Fork 26
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
SDK not working in browsers #595
Comments
I'll update that guide as it's not completely accurate but in a browser environment you will need to polyfill I believe if you add this to your "browser": {
"fs": false
}, Let me know if that works and I'll update the guide to mention this. |
Hey, thanks for the response. I still use the API in my server code :) |
This doesn’t work, because you’re importing |
Or, maybe, if you could simply make sure to have a pure browser compatible build that you allow to use via package.json |
Alright I've got a PR here1 to move from Footnotes |
Thanks, appreciate the effort. Very eager to use the api package with some readmeio libraries (including our own that we host on readme) on cloudflare workers. |
I've just published v5.0.7 which changes our |
Hi @erunion! I'm also having trouble running this in the browser, and I've got a React TypeScript app using Vite The initial error I get is:
If I add some Node polyfills, I get this:
Which is caused by:
Also tried adding Would love to get this to run, as the generated code seems really good. Any ideas? Thanks in advance! |
@JPCanaverde There's some discussion about that in #604 but I haven't had a chance in a while to dig into how to resolve it. |
@erunion thanks 🙂 I managed to find a workaround. |
Hey,
In the FAQ it says
"If you generate an SDK with the CLI installation process then yes! If you're having trouble getting autogenerated SDKs working in a browser"
I use
npx api install ***
to install my sdk, but when I try to use it I getModule not found: Can't resolve 'fs/promises'
I see that the generated code imports
/api/dist/core
which import theprepareParams.ts
, and that file imports nodejs modules.Thank you, for your help.
The text was updated successfully, but these errors were encountered: