-
-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove process.env
usage from the core
#35
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -100,11 +100,7 @@ export function createEnv< | |||
): z.infer<ZodObject<TServer>> & z.infer<ZodObject<TClient>> { | |||
const runtimeEnv = opts.runtimeEnvStrict ?? opts.runtimeEnv ?? process.env; | |||
|
|||
const skip = | |||
opts.skipValidation ?? | |||
(!!process.env.SKIP_ENV_VALIDATION && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is originally from create-t3-app
, and I don't think we should use this (process.env.SKIP_ENV_VALIDATION
) anymore, and let the create-t3-app
mention about this in docs instead.
You just need to define the skipValidate option and this wont be hit. This is also stated in the docs. Atleast thats how my tests have been concluded. Do you see other behavior? |
@juliusmarminge Just notice that side note in the docs, but the explanation wasn't clear enough why the library reference process.env, even though the doc kinda mention about SKIP_ENV_VALIDATION a bit, but it shows as an example instead of mentioning that the library will use it internally. |
IMO having to specify the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine - I'll cave..
If we try to use this package in Vite (SPA) project, it will throw an error
Uncaught ReferenceError: process is not defined
on client-side, as Vite is usingimport.meta.env
instead ofprocess.env
.So, the fix is to remove all the existing
process.env
usage.