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
@jtawf that's actually a bug we discovered today + we are updating the docs as we speak
ok thanks!
Link to stage docs
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.
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 😊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?
It should already work out of the box 🤔 did you modify the tsconfig.json by any chance?
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?
@soda09802 if you could take a look tomorrow
ya we're getting burned by this too
@jtawf the fix for
.env.client
is out now 🙂
curl -sSL https://get.wasp-lang.dev/installer.sh | sh
to update@jtawf and @HufflePuffDaddy did this solve the problem for you?
Yes I'm set on this one
Awesome!