W
Wasp2y ago
jtawf

using client-side env variables

I'm using .env.client however i'm told process is undefined and the documentation provides no reference to this, how can I resolve this? @Wasp Team
14 Replies
miho
miho2y ago
@jtawf that's actually a bug we discovered today + we are updating the docs as we speak
jtawf
jtawfOP2y ago
ok thanks!
miho
miho2y ago
Link to stage docs
miho
miho2y ago
Env Variables | Wasp
Environment variables are used to configure projects based on the context in which they run. This allows them to exhibit different behaviors in different environments, such as development, staging, or production.
miho
miho2y ago
1️⃣ import.meta.env is how you want access the env variables since we are using Vite 2️⃣ I'll ping you tomorrow when we release a version with the bug fix for .env.client 😊
jtawf
jtawfOP2y ago
thanks @miho, do i have to change the module flag as mentioned (The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.) or will the fix include that?
miho
miho2y ago
It should already work out of the box 🤔 did you modify the tsconfig.json by any chance?
jtawf
jtawfOP2y ago
for some reason it doesn't, i never modified ts.config either when i added the module flag it threw different errors about not being able to find other modules like react or @wasp/types Error Message: Cannot find module '@wasp/entities'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? Cannot find module 'react'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? Cannot find module '@aws-sdk/client-s3'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?
miho
miho2y ago
@soda09802 if you could take a look tomorrow
HufflePuffDaddy
ya we're getting burned by this too
miho
miho2y ago
@jtawf the fix for .env.client is out now 🙂 curl -sSL https://get.wasp-lang.dev/installer.sh | sh to update
martinsos
martinsos2y ago
@jtawf and @HufflePuffDaddy did this solve the problem for you?
HufflePuffDaddy
Yes I'm set on this one
martinsos
martinsos2y ago
Awesome!

Did you find this page helpful?