Is it possible to control vercel runtime via env variable? #6825
-
QuestionI'm using app router and want to do something like this to control vercel runtime:
However, it doesn't work as expected. If I simply put |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@derek-cove It needs to be statically analyzable so you can't hide it behind a ternary with an env var, you could do some metaprogramming to swap in the build step to set the runtime if you really need. |
Beta Was this translation helpful? Give feedback.
-
Thanks @versecafe ! Do you have any docs or an example of how I might do this? I guess the idea is to have my build step modify or create the |
Beta Was this translation helpful? Give feedback.
@derek-cove Yep the way would be to modify the
route.ts
files, and thennext build
, you could do something like a bun script that parsesapp/**/route.ts
and then some string parsing maybe have a comment likewhich would get modified into
Or
And then run
next build
, after the build step completes parse back over and convert all instances ikeback into