Replies: 1 comment
-
|
Hey @xmlking - thanks for asking! Basically, you can declare any variable there, but you need to ensure that it's available in both environments. That said, for most client frameworks, environment variables are injected as plain strings during the build. The example you shared would work if you explicitly declare the variable in the import { defineEnv } from "envin";
export default defineEnv({
shared: {
BASE_URL: z.url(),
},
env: {
BASE_URL: process.env.NEXT_PUBLIC_BASE_URL /* using NEXT_PUBLIC here to make sure the variable will be injected to client-side code */
}
});Hope this helps! |
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.
-
docs say the
sharedenv variables can be used in client side react component.will it work in even if I don't have prefix:
NEXT_PUBLIC_?lets say if I have following env config, can I access
BASE_URLviaenv.BASE_URLin client component?Beta Was this translation helpful? Give feedback.
All reactions