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

211
Views
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
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!