When using NextJS to build a static site, I would like the getInitialProps method to fire only during the build step and not on the client.
getInitialProps
In the build ste
I found the workaround with NextJs 9.0.3 (other versions may also work, I didn't test that)
// XXXPage is your page XXXPage.getInitialProps = async (req) => { if (process.browser) { return __NEXT_DATA__.props.pageProps; } // original logic }