Environment Variable Doc Improvements #10580
bestickley
started this conversation in
Ideas
Replies: 1 comment
-
|
After thinking through this more, my comments related to |
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.
-
Goals
Non-goals
None
Background
The docs state:
From my understanding,
API_KEYshouldn't result in miss cache for build task. When a Next.js app or Express/Fastify app is built withesbuildfor example and I reference an environment variable likeprocess.env.API_KEYtheAPI_KEYis not bundled into the output. You have to specify--defineor in Next.js prefixed env var withNEXT_PUBLICor do something special for the env var to be bundled into output.Therefore, I think that docs are misleading. From my understanding, really the only env vars that need to result in cache miss are the framework inference ones (thank you for making that easy!).
Proposal
My recommendation is to change:
Turborepo needs to be aware of your environment variables to account for changes in application behavior.
to
Turborepo needs to be aware of your environment variables that are bundled into your app's build to account for changes in application behavior.
and change the example API_KEY to NEXT_PUBLIC_API_KEY.
Additionally, I think the first question is not correct:
It should be: Which environment variables are included in my app's builds such that I need to tell turbo to include them in the task hash?
Beta Was this translation helpful? Give feedback.
All reactions