-
Notifications
You must be signed in to change notification settings - Fork 396
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
@atproto/api package imports throwing in SSR apps #330
Comments
Javascript module issues amiright? Yeah I remember having some issues with sveltekit & CommonJS modules in the past. Which code are you actually pulling in here? Hoenstly, none of our libraries are quite ready to be building with yet (although we're stoked to have people playing with them!) - we'll be doing a DX pass on all of these, cleaning up, publishing & hopefully sorting out these module/build issues before long. |
@dholms This happens when importing either from I'll keep playing with the packages and will report if I find anything else! |
Would be happy to try to contribute this change! People building sites with Astro like a couple of us are in this discussion don't really have a viable workaround #1153 |
@atproto/api
currently does not work natively with SSR apps when served server-side (e.g. built with sveltekit and served with Vite). You'll get the errorexports is not defined at ajv-formats/dist/index.js:4:23
. I believe this has to do withajv-formats
being a CommonJS module.The api can only be imported in the client-side when doing it like
const api = await import("@atproto/api");
in the browser side (i.e. inside anonMount()
) which adds big initial page load times since it's loaded into the browser session separately rather than being a part of the vite-generated js chunks.The text was updated successfully, but these errors were encountered: