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

env validation for react-vite #214

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SaqibAltaf
Copy link

Package installed
yarn add -D @julr/vite-plugin-validate-env

Modified files
apps/react-vite -> vite.config.ts
vite.config.ts

this is added in vite.config.ts
ValidateEnv({
VITE_APP_API_URL: Schema.string(),
VITE_APP_ENABLE_API_MOCKING: Schema.boolean(),
}),

it will validate env during build

Copy link

netlify bot commented Sep 26, 2024

Deploy Preview for bulletproof-react-app ready!

Name Link
🔨 Latest commit 4c52388
🔍 Latest deploy log https://app.netlify.com/sites/bulletproof-react-app/deploys/66f56613ecd4e00009cf43f9
😎 Deploy Preview https://deploy-preview-214--bulletproof-react-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@SaqibAltaf
Copy link
Author

Package installed yarn add -D @julr/vite-plugin-validate-env

Modified files apps/react-vite -> vite.config.ts vite.config.ts

this is added in vite.config.ts ValidateEnv({ VITE_APP_API_URL: Schema.string(), VITE_APP_ENABLE_API_MOCKING: Schema.boolean(), }),

yarn add -D @julr/vite-plugin-validate-env

plugins: [
react(),
viteTsconfigPaths(),
ValidateEnv({
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks for making this PR. I think we can pass Zod schema here from src/config/env, to make it consistent...

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.

2 participants