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

Improve environment variables support #1726

Open
brillout opened this issue Jul 2, 2024 · 2 comments
Open

Improve environment variables support #1726

brillout opened this issue Jul 2, 2024 · 2 comments
Labels
enhancement ✨ New feature or request

Comments

@brillout
Copy link
Member

brillout commented Jul 2, 2024

Description

@brillout brillout added the enhancement ✨ New feature or request label Jul 2, 2024
@7iomka
Copy link

7iomka commented Jul 4, 2024

image Why my `import.meta.env` is undefined?

@brillout
Copy link
Member Author

brillout commented Jul 4, 2024

@7iomka It's a Vite design limitation: import.meta.env isn't defined in any config file, neither inside Vite's vite.config.js file nor inside Vike's +config.js files.

Because, in order to determine whether the production or development environment variables should be applied, the value of Vite's mode setting needs to be known. And note that mode can be defined inside vite.config.js.

A possibility would be to stop using Vite's mode implemention and have Vike implement its own mode feature. (While we could make import.meta.env work inside +config.js and vike.config.js files, I ain't sure we could make it work inside vite.config.js files: to be researched.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants