Vite-like envDir config #72862
eric-burel
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
Background
We use a monorepo for the State of JavaScript surveys, running an API, 2 Next.js apps, an Astro app and a Gastby app.
They consume similar databases and thus need similar configuration. Handling .env files in each app is very confusing and requires a lot of management.
We'd be eager to load
.env
files from the root folder just above our Next app folder.Calling
loadEnvConfig
frominstrumentation.ts
doesn't work because it must be edge-runtime compliant and it relies on "fs" to open the .env files. I suspect this would raise issues with bundlingNEXT_PUBLIC
variables.Calling this function from
next.config.js
doesn't seem to work.Vite does have an envDir option for this use case.
Proposal
Support an "envDir" variable in
next.config.js
, that can point to the root folder:envDir: "../"
.Beta Was this translation helpful? Give feedback.
All reactions