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

217
Visualizações
Read environment variables outside of next js

I am using next js as the basis for my application. My environment variables work as long as they are read within the scope of next js but I need to use them inside a script that does not use next js.

With dotenv we can do the following:

require('dotenv').config();

Which parses the environment config files and allows you to get the variables from process.env.

Because I am using next js I would prefer to use their environment variable implementation instead of adding a second way to store environment variables.

Is there an equivalent of require('dotenv').config(); for next js or another way to load the environment variables outside the scope of next js?

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

0

Ok I went into the git repo of next js and found a way to do it.

You have to install @next/env and then run require('@next/env').loadEnvConfig('./');

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