Skip to content
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

Build time validation for client env #2392

Open
wants to merge 10 commits into
base: miho-zod-env
Choose a base branch
from

Conversation

infomiho
Copy link
Contributor

@infomiho infomiho commented Nov 29, 2024

This replaces build-time env validation validate-env.mjs script (removed in #2362) with a simple Vite plugin. It removes the dotenv dep requirement and uses the same Zod schema that the runtime validation uses.

In development it displays an overlay in the user's browser if the env var validation failed:

Screenshot 2025-01-14 at 12 21 56
Error displayed in the user's browser

When building it exits the build process:

Screenshot 2025-01-14 at 12 21 01
Build command fails in the terminal

@infomiho infomiho force-pushed the miho-zod-env-client-build-time branch from 432d2f4 to 35bb045 Compare November 29, 2024 10:15
@infomiho infomiho marked this pull request as ready for review January 14, 2025 11:24
@infomiho infomiho requested a review from sodic January 14, 2025 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant