Replies: 1 comment
-
This is possible! You can split the build into two steps by using the next build experimental option documented here: The app will still compile build time env var into source so don’t use them and instead use a runtime env option. For App Router you can use the next-runtime-env npm package. Page Router has first party support for runtime env by using the runtimeConfig next.config option. |
Beta Was this translation helpful? Give feedback.
0 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
next build
tries to read bunch of environment variables (yes I read posts and I don't care about dynamic routes, SSR etc, this should not be my concern) - bottom line is: 1next build
, 1 docker image, ALL env vars loaded via .env at runtime!Non-Goals
Background
Right now because I need a bunch of env vars when running
next build
, some of which get inlined in generated code, I am forced to do either one of these:Proposal
Give me an option to run build that does not require ANY env vars to be set, no matter how I implement my page.
Beta Was this translation helpful? Give feedback.
All reactions