Skip to content

using Local API with React SSR from frontend #312

Answered by jmikrut
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @Aruinerk — this is a great question!

One of the tough parts about loading Payload in an SSR app that you roll by yourself is that you need to ensure that no server-side code makes its way into your client-side bundle. For example, Payload itself loads many Node packages, like Express, Mongoose, GraphQL, and other dependencies. You don't want your client-side bundle bloated with this code. Not to mention—some Node packages will simply break your code while running in the browser due to needing filesystem access, etc.

However, some SSR frameworks like NextJS come with solutions to this packaged in. Next, for example, will automatically eliminate any dependencies that are only used in g…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant