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

206
Vistas
Why is a statically generated page unstyled when sent to the client?

When running the Next.js official boilerplate npx create-next-app and previewing it in the browser, I noticed the statically generated html document isn't styled:

enter image description here

I believe this could lead to FOUC problems. How can I make sure that the page is already styled when served to the client, as in the case of Next.js' official site:

enter image description here

Note: I just created a boilerplate project using npx create-next-app and did not modify any code. I am using Next.js v12.0.7 and React v17.0.2.

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

0

To get the response similar to Next.js' website, you need to inline critical CSS. This is (still) experimental in next@12.0.7 (and undocumented). To enable it modify your next.config.js:

module.exports = {
  experimental: { optimizeCss: true }
}

You need to install critters (yarn add -D critters or npm i -D critters) for this to work. Also, you need to run production build (next build && next start) not a dev one like you're doing in that image you have shared.

Result:

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