3

Looking at the docs it seems like you can use getStaticProps and getStaticPaths as optimizations at build-time (for either static Next.js sites or SSR Next.js sites), and you're required to use getServerSideProps for SSR.

I'm looking to support both completely static sites (i.e. no SSG/data needed @ build time/serve from nginx or S3) and SSR.

Is there any way to disable SSR completely for the static build (i.e. a build flag)? Or do I need to omit or remove these functions at build-time?

Josh
  • 57
  • 4
  • Ended up using https://www.npmjs.com/package/webpack-strip-blocks and https://nextjs.org/docs/api-reference/next.config.js/custom-webpack-config to conditionally remove the code at build time. – Josh Apr 21 '21 at 19:20
  • just load app component dynamic like that https://stackoverflow.com/a/64509306/5322183 – Sergey Molyak Feb 01 '23 at 09:13

0 Answers0