#Accessing env vars in the client

4 messages · Page 1 of 1 (latest)

thin fossil
#

Is there a way to access an env var (parsed via process.env in the client? It's a CLIENT_ID that I need to share between client and server.

If I import it directly and/or pass it to the client via loader data I receive some weird errors probably caused by tree shaking removing those variables.

wanton plinth
#

import.meta.env

#

and they must start with VITE_ to be available to the client

#

You can modify that prefix if you want