According to the documentation, next export
is for exporting your project into static HTML. More importantly, the docs state (emphasis mine):
next export
is intended for scenarios where none of your pages have
server-side or incremental data requirements (though
statically-rendered pages can still fetch data on the client side
just fine).
If you're looking to make a hybrid site where only some pages are
prerendered to static HTML, Next.js already does that automatically
for you! Read up on Automatic Static Optimization for details.
next export
also causes features like Incremental Static Generation
and Regeneration to be disabled, as they require next start or a
serverless deployment to function.
This means that if your routes need server-side data fetching with getServerSideProps
, you'll need to do run the project as a Node.js server either through Next.js (next build && next start
), or with a custom node server.