staticwebdev / nextjs-starter

A Next.js starter application for deploying to Azure Static Web Apps
https://docs.microsoft.com/azure/static-web-apps/deploy-nextjs
31 stars 27 forks source link

Transition Next.js Static Web App Starter to Next.js Static Export #13

Closed rconard closed 3 years ago

rconard commented 3 years ago

The current version of nextjs-starter uses getInitialProps instead of getStaticProps.

This PR updates the starter to use getStaticProps and getStaticPaths and adds next/head and next/link where appropriate.

See the Next.js Static Generation docs here.

I created this PR after using the nextjs-starter generator for a project and ran into issues with getInitialProps that were difficult to debug. Because getInitialProps works reliably during local development, this issue occurs in GitHub Actions CI/CD where it is considerably harder to debug. By updating the starter to use getStaticProps, this issue will be avoided in the future.

anthonychu commented 3 years ago

@craigshoemaker could you please look at this one as well?

staticwebdev commented 3 years ago

Thanks for this, @rconard!

With commit b6dbddd78d5c30191f7cf2ea6aebe06ffa748803, we updated the repo to use getStaticPaths and getStaticProps. The implementation we chose was minimal on purpose in an effort to make the app as easy to understand as possible.

Your changes are an excellent addition to the app, but for now, we're going to just stick to the more streamlined version of supporting the updated API.

We really appreciate your contribution and look forward to further ideas you may have in the future!