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

232
Visualizações
Styled components with NextJS 12 not working server side (missing css first render)

With the recent NextJS 12 release, the styled-components is now supported without needing any plugin on top of NextJS.

But i cant seem to have it work with server side rendring.

To enable it, i installed the styled-components package and added the following in my config file.

module.exports = {
  compiler: {
    reactStrictMode: true,
    styledComponents: true,
  },
};

The styles are working on the client but the first render is missing the css styles. If i view the source page, can't see any css styles added there.

about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

I have faced this exact issue but had to switch on another project. Maybe try this in your config

/** @type {import('next').NextConfig} */

const nextConfig = {
  reactStrictMode: true,
  compiler: {
    styledComponents: true,
  },
}

module.exports = nextConfig

Source: https://styled-components.com/docs/advanced#with-swc

about 4 years ago · Santiago Trujillo Relatório

0

I recommend using NoSSR in nextjs.

So, you can use the following.

import dynamic from "next/dynamic";
...
const SidebarWithNoSSR = dynamic(() => import("./Sidebar"), { ssr: false });
...
about 4 years ago · Santiago Trujillo 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