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

222
Vistas
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 Respuestas
Responde la pregunta

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 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