Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

390
Vistas
Next.js SSR/ISR creating HTML static file for non-static page

What would cause a static HTML to be created for a non-static page using Next.js? I'm unsure if it's causing any issues, but I noticed this was happening while troubleshooting an issue with this specific page. Is this expected?

What I mean is that we have one page, let's call it "page1", that does not have the getStaticPaths() or getStaticProps() functions.

This page does rely on server-side data, but does not make use of getInitialProps() or getServerSideProps() as they are deprecated.

When I cd into the build directory I can see the .next/server/pages/page1.html - is this expected? There is no page1.json file. If not, what would cause this HTML file to be created?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Yes, that's expected. It's Next.js' Automatic Static Optimization at play.

If your page does not contain getServerSideProps/getInitialProps, then Next.js will automatically statically optimize the page and prerender it as static HTML.

From the docs:

If getServerSideProps or getInitialProps is present in a page, Next.js will switch to render the page on-demand, per-request (meaning Server-Side Rendering).

If the above is not the case, Next.js will statically optimize your page automatically by prerendering the page to static HTML.

During prerendering, the router's query object will be empty since we do not have query information to provide during this phase. After hydration, Next.js will trigger an update to your application to provide the route parameters in the query object.

next build will emit .html files for statically optimized pages.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda