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

Is the a way/alternatives to access process.env? #213

Closed
hxhieu opened this issue May 21, 2020 · 3 comments
Closed

Is the a way/alternatives to access process.env? #213

hxhieu opened this issue May 21, 2020 · 3 comments
Labels

Comments

@hxhieu
Copy link

hxhieu commented May 21, 2020

Is your feature request related to a problem? Please describe.

We need a way substitute Vue app configuration depending on the target build environments.
For example, API endpoint will be different between local and production build.
With vue-cli we can use the .env file.

Describe the solution you'd like
N/A

Describe alternatives you've considered
N/A

Additional context
N/A

@yyx990803 yyx990803 added the enhancement New feature or request label May 21, 2020
@pedzed
Copy link

pedzed commented May 21, 2020

I would love to use a .env file as well. How can you achieve something like that? And what is the best practice for doing regular config?

@yyx990803
Copy link
Member

Should be fairly straightforward to support:

  1. Load .env with https://github.com/motdotla/dotenv and include it in the resolved config in https://github.com/vuejs/vite/blob/master/src/node/config.ts

  2. Inject it to dev html here

  3. Inject it to build config here

@daychongyang
Copy link
Contributor

Need to load environment variable files for different modes ?

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants