Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

221
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!