[QUESTION]: Pass ENV variables from server to client without replacing in the code #1487
-
Hi, I have a quick question. So now I am wondering, if I wanted to pass process.env.ROOT_URL (example) to my client side but not have it bundled in the production and actually take it from the actual environment variable, how would I do this? I know I can inject html from the server to the client side and pick it up later this way. Sorry if I am not clear. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If your en var is expected to be determined/changed dynamically at runtime, then you'll indeed have to use |
Beta Was this translation helpful? Give feedback.
If your en var is expected to be determined/changed dynamically at runtime, then you'll indeed have to use
pageContext
andpassToClient
. As described in the Data Fetching guide.