Skip to content

env.ts doesn't apply .default("value") to client #45

Description

@IanMitchell

If I have a env.ts:

import { defineEnv, string, number, oneOf } from "void/env";

export default defineEnv({
	VITE_GIT_COMMIT_SHA: string().default("5b7ea6bb52e16fefde46edab8a136fc6c89e02ec").public(),
	PORT: number().default(3000),
	NODE_ENV: oneOf(["development", "production"]).default("development"),
});

And try to reference env.VITE_GIT_COMMIT_SHA in a React component, without explicitly setting it, the app will crash.

If I explicitly set it via VITE_GIT_COMMIT_SHA=123 vp dev, the app works as expected.

I believe right now y'all only apply .default to backend values but don't apply it to frontend ones

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions