No bare import.meta.env expression workaround on the client-side
#3146
Replies: 1 comment 8 replies
|
I find using t3 env convenient as I get the zod validation and typescript support. So using those variables directly makes it not as convenient as defining schema in one place and then accessing it via env.SOME_ENV anywhere in the code via So in client I list all env vars I need on client, shared is mostly used for some constants, and there is no server (for now), as those apps are static landing sites Matomo specifically is enabled or disabled here: (I did fix the import.meta.env usage here, but didn't find a way to fix our t3 env usage) And I could pass it in runtime env manually, but then I think it defeats the point of using this object anyway But if there are better ways I would like to explore them too as well |
Uh oh!
There was an error while loading. Please reload this page.
Follow up of:
@MrNaif2018 Why aren't you following the recommendation of using
import.meta.env.SOME_ENVinstead of non-statically-analyzable syntax likeconst { env } = import.meta; env.SOME_ENV? See https://vike.dev/env.All reactions