Identify build-time vs run-time on server #66832
-
Hello! const endpoint = process.env.IS_BUILD_TIME ? 'https://my-cached-server.com' : 'https://my-fresh-data-server.com' |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
You can do this through the environment variable configuration file
|
Beta Was this translation helpful? Give feedback.
-
Hi @SouthLink, thank you for your answer. |
Beta Was this translation helpful? Give feedback.
yeah, NEXT_PHASE is still there, and the PHASE_PRODUCTION_BUILD you get from next/constants, though these are not very well documented now, they used to be...
Though I'd say, you can also try to inject your own env var in next.config.js, using the
config
as function option.