Before implementing Nextjs SSG (static side generation), the loading speed during development is normal and acceptable. However, after implementing Nextjs SSG, the development speed is really slow, even though I know after building the project is fast. Trying to navigate to another SSG page also takes few seconds, but in production, it just so smooth.
Supposed SSG during development is similar to SSR, so the loading shouldn't be that slow during development. Am I right?
Want to ask is there any way to improve the loading speed for development? so that it doesn't hurt the development time.
For my case, the first issue is due to there are multiple async await in the getStaticProps()
. So I changed it to use Promise.all()
instead and the page now loads more faster in development.
The second issue is due to the imports. Can check the github link on the solution.
After making the 2 changes, the application load is way faster now in development mode. And I'm sure the changes also help improve the build time for production.
P.S. I think Next.js dynamic import will also help improve the speed as some components likely not needed in the server side.