Skip to content
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

[Doubt] Can i deploy react app with static build and serverless react components? #81

Open
useEffects opened this issue Sep 2, 2024 · 6 comments

Comments

@useEffects
Copy link

We are exactly looking for this approach

using an AWS Lambda Function, with AWS CloudFront as CDN

I am skimming through the aws-app code and I couldnt find where you are building the react app as a static export, you are only deploying the entire application to a lambda, which we are not looking for. We are looking for deploying the react app as a bundle in CDN, power the react server components through lambda functions.

@useEffects
Copy link
Author

I really think what we are looking for is possible through this repo :)

@unstubbable
Copy link
Owner

unstubbable commented Sep 3, 2024

MFNG does not offer a static export of pages as it does not have a concept of file-based routes. The static client assets as well as the server-side rendered responses can be cached in a CDN though, which the AWS example app has configured in https://github.com/unstubbable/mfng/blob/main/apps/aws-app/cdk/stack.ts.

@useEffects
Copy link
Author

We are looking for an SPA static export with RSC, the RSC not only be bundled at build time, but the RSC components should be hydrated through serverless functions.

@useEffects
Copy link
Author

if you couldnt figure out what I am trying to look for, please let me know :)

@unstubbable
Copy link
Owner

unstubbable commented Sep 3, 2024

Statically built RSC components don't need serverless functions to be hydrated. You only need a CDN and a browser to accomplish that. But again, MFNG does not offer a static build of RSC components. Instead, it needs a request handler (e.g. a serverless function) to render them at request time (in case of a CDN cache MISS). If you're looking to create fully or partially static RSC output at build time, I recommend using Next.js.

@useEffects
Copy link
Author

we dont want static build of RSC components either, I will play with the repo for now and let you know if this can fulfill our requirements. Next.js is out of our scope because we only want static export of a single react component and deploy it in CDN which later can be used in html pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants