-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
meta: refactor data generation to server-side only #6137
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Lighthouse Results
|
great change. And why not using route handler to generate data. And use fetch api to consume data ? |
Because, not sure you forgot, we need to support static exports. |
Also why the hell would we want to use an API endpoint for static data. |
yes with static export it's doesn't work
To reduce custom part and use such as possible nextjs api. |
Sorry, but this doesn't make much sense. This static data needs to be available directly at component level. Using an API means this data would be moved to "getStaticProps" or something similar or require It is a path, and would work, but I doubt it is something that makes sense for something that is just config data. For the blog post data and release data, I could explore this path, so that we don't call this endpoint on every bootstrap of ISR, but still, something that I need to honestly check what would be the best appropriate path here. |
This is proving complex. Ill meditate about this later. |
Don't worry, what you've updated is great. |
Done, I think I was able to stretch some brain cells to their limit. |
cc @nodejs/web-infra would love some reviews of people that know their stuff around web |
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.
why route handler is under [local] ? it's not possible to put on app/api/...
?
the rest to support static export is superbly done
No. You also forget that nodejs.org/api is a reserved word. It goes to our api docs. |
true but my real question is why put route handler under I18n |
Everything in our website goes under a /language/ top level route. To prevent the future where some cloudflare settings could block us from using more than /[locale]/ it just made sense. Also if in the future we translate any of these, they would already be in the right place 😉 |
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.
my initial review - I'd still like to pull it down locally and run it on Windows
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.
Great update 🎉 I think this is an update that will make the process more understandable for contributors/newcomers. I left my review notes
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.
aside from the comments already mentioned - i wanted to say this looks all good on Windows
919cc49
to
24efd78
Compare
Description
This PR completely removes the data generation (blogData, nodeReleaseData) from the client-side and completely removes the generation to be done as a pre-build/pre-serve script.
This allows us to generate the data on-demand within Next.js itself and enable HMR of the data if needed.
This removes the need of stashing, unstaging the pesky files from
public/
on every commit and checkout.This completely removes these JSON files (including site navigation, site config, etc) from the client-side and make them a server-side/static-only data. Which completely removes them from the client-side bundle and drastically reduces the bundle size.
Validation
All pages should be working as expected.