Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

387
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda