Skip to content

Update mode-and-env.md #4257

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

Merged
merged 3 commits into from
Jul 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/guide/mode-and-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ FOO=bar
VUE_APP_SECRET=secret
```

Note that only variables that start with `VUE_APP_` will be statically embedded into the client bundle with `webpack.DefinePlugin`.

For more detailed env parsing rules, please refer to [the documentation of `dotenv`](https://github.com/motdotla/dotenv#rules). We also use [dotenv-expand](https://github.com/motdotla/dotenv-expand) for variable expansion (available in Vue CLI 3.5+).

Loaded variables will become available to all `vue-cli-service` commands, plugins and dependencies.
Expand Down Expand Up @@ -80,7 +82,7 @@ In both cases, the app is built as a production app because of the `NODE_ENV`, b

### Using Env Variables in Client-side Code

Only variables that start with `VUE_APP_` will be statically embedded into the client bundle with `webpack.DefinePlugin`. You can access them in your application code:
You can access env variables in your application code:

``` js
console.log(process.env.VUE_APP_SECRET)
Expand Down