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

212
Visualizações
Next.js standalone not reading env file

I have a question about my Next.js project.

I have configured my project to be build over the standalone mode for the deployment

experimental: {
    outputStandalone: true
}

Using this, it generates me a standalone folder with a server.js like expected.

The main issue is that I am using an env variable in my sources, called NEXT_PUBLIC_API_BASE_URL

When I start my project in development mode (using next serve), it works fine.

But when I start the standalone generated file (using node server.js) it does not work.

It seems that the file is loaded on the "server side", when I console.log its value in the .next/standalone/server/pages/_app.js it shows the right value in the node console.

But it looks like next is using files under .next/static/chunks/pages/ and an other app.js that does not seem to access process.env (on browser side).

I thought that prefixing my env var with NEXT_PUBLIC was meant to work this way, it seems not.

Any idea on how it works there ?

about 4 years ago · Santiago Gelvez
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