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

docs: set dynamic env variables in config file #19136

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JJAHMEDAMER
Copy link

Added an example demonstrating how to set environment variables in the Vite config file.

Description

Included a dynamic setup for the latest Git commit hash (VITE_CODE_VERSION) as an environment variable using execSync. This ensures the app can reference the commit hash during build time

@JJAHMEDAMER JJAHMEDAMER changed the title Set dynamic env variables in config file docs: Set dynamic env variables in config file Jan 4, 2025
@JJAHMEDAMER JJAHMEDAMER changed the title docs: Set dynamic env variables in config file docs: set dynamic env variables in config file Jan 4, 2025
@bluwy
Copy link
Member

bluwy commented Jan 7, 2025

Should this be documented at https://vite.dev/config/shared-options.html#define instead? I think we can have a simple line mentioning that you can specify constants like import.meta.env.* too.

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