Charles Forsyth

Charles Forsyth

My initial thoughts about Next.js

Initial thoughts

My first impressions of Next.js are pessimistic. We all know the value of server-side rendered content, for SEO, performance, and end-user experience. However, a ballance between server and client rendered content must be made. It can't be all one or the other.

Next.js offers three flavors of pre-rendered content:

  • Pre-rendered content with static props.
  • Pre-rendered content with static paths.
  • Pre-rendered content with server-side props.

It is possible to pre-render partial pages and then fetching the data from the client-side.

In addition they have created a React Hook named SWR. This stands for stale-while-revalidate, which is an HTTP cache invalidation strategy. The idea is to serve cached data as stale, and in the background revalidate it and update the data automatically as needed. This lends itself to a much faster appearing user interface.

Observations

While deploying my site to Vercel, as per the instructions, I encountered several errors related to module imports being case-sensitive. However, in my local environment, they are not case-sensitive and the site works fine. No errors, even when I npm run build it builds find. But building on the Vercel server, the imports fail.

In addition: When these errors occur in the build process on Vercel, I noticed there is no way to back out of them. One must refresh the entire page, if the build fails. I feel this is a bug with Vercel that should be addressed.