Hello guys
We have some env variables setup in edg Environments | Edgio Documentation
We can access those at the build time. How can be get those env also at client side with NextJS? This is more of NextJS issue for sure
Thanks
Hello guys
We have some env variables setup in edg Environments | Edgio Documentation
We can access those at the build time. How can be get those env also at client side with NextJS? This is more of NextJS issue for sure
Thanks
How about edg env pull my-file.env
?
I think that could work. In edgio console, defined env variable like this:
NEXT_PUBLIC_ANALYTICS_ID
And then add to the build process, before running the actual build
edg env pull .env.production
As per Basic Features: Environment Variables | Next.js
I wonder if maybe just naming the variable and than running the build might work just like that
If I understand the ask correctly, so long as the env vars are prefixed with NEXT_PUBLIC_
, then you can use them on the client with process.env.NEXT_PUBLIC_XYZ
.
Now if they are defined in Edgio console, you will need to do edg env pull ...
as you referenced to bring them local for building/local dev.