-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Add an example using ESI cache (with React ESI) #6225
Conversation
}, | ||
"scripts": { | ||
"dev": "nodemon --exec babel-node src/server.js localhost 3000", | ||
"build": "babel src -d dist && next build dist", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed: babel src -d dist &&
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's weird to run babel
over the src
directory 🤔 You'd be triple parsing and compiling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that React ESI needs to be able to serve the components (src/components
) directly. Is it possible to reuse the ones compiled by Next?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, that makes it indeed harder, all components are put into a single bundle per page and are not available to be required outside of the bundle, so that is an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a bunch of feedback 🙏 Looks like a nice solution 👍
Thank you very much for the feedback @timneutkens. I simplified the example. |
As far as I understand, the build failure is unrelated to this PR. |
Hi @timneutkens, is this PR ready to be merged on your side? Thanks! |
@dunglas could you send me a DM on twitter.com/timneutkens / https://spectrum.chat/users/timneutkens |
React ESI is a brand new cache library for vanilla React and Next.js applications, that can make highly dynamic applications as fast as static sites by leveraging the open Edge Server Include specification.
https://github.com/dunglas/react-esi
Because this spec is widespread, React ESI natively supports most of the well-known cloud cache providers including Cloudflare Workers, Akamai and Fastly. Of course, React ESI also supports the open source Varnish cache server that you can use in your own infrastructure for free (configuration provided).
This PR shows how to integrate React ESI with Next.js.