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

167
Visualizações
Does NextJS include libraries that are referenced only in getServerSideProps in the bundle?

I have a Next.js page that is fetching data from a database (using prisma as the ORM) inside of getServerSideProps().

I working based on this example from an official Prisma github. Here is a simplified version of the page setup:

import prisma from 'prisma';

export const getServerSideProps = async ({ req, res }) => {
  const drafts = await prisma.post.findMany(...);
};

const MyPage = () => {return <div>Hello</div>};
export default MyPage;

Prisma is imported into the page file and is referenced in getServerSideProps() but is not referenced in the actual page component that is exported. My question is, will prisma be included in the bundle sent to the browser with this page? Or is Next smart enough to trim packages that are referenced only in server-side functions?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

No. It will not be bundled to the client side. Next.js is indeed smart enough.

Refer here : https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering

enter image description here

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