From aa6b73f10e848203feef23d216b370ac7ddeb7b5 Mon Sep 17 00:00:00 2001 From: Mohsen Sadeghzade Date: Wed, 10 Jul 2019 07:09:31 +0430 Subject: [PATCH 1/3] Update mode-and-env.md Fixed example of keys, which they should start with VUE_APP_ --- docs/guide/mode-and-env.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/guide/mode-and-env.md b/docs/guide/mode-and-env.md index 03437e39a3..d09084d77f 100644 --- a/docs/guide/mode-and-env.md +++ b/docs/guide/mode-and-env.md @@ -42,10 +42,12 @@ You can specify env variables by placing the following files in your project roo An env file simply contains key=value pairs of environment variables: ``` -FOO=bar +VUE_APP_FOO=bar VUE_APP_SECRET=secret ``` +Please note that only variables that starts with `VUE_APP_` are loaded on the client. + 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. From 5d729d992c15c602c4bc5dee489a2ec42c042696 Mon Sep 17 00:00:00 2001 From: Mohsen Sadeghzade Date: Wed, 24 Jul 2019 08:07:43 +0430 Subject: [PATCH 2/3] Update mode-and-env.md change position of the tip --- docs/guide/mode-and-env.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/guide/mode-and-env.md b/docs/guide/mode-and-env.md index d09084d77f..00e6d11d27 100644 --- a/docs/guide/mode-and-env.md +++ b/docs/guide/mode-and-env.md @@ -42,11 +42,11 @@ You can specify env variables by placing the following files in your project roo An env file simply contains key=value pairs of environment variables: ``` -VUE_APP_FOO=bar +FOO=bar VUE_APP_SECRET=secret ``` -Please note that only variables that starts with `VUE_APP_` are loaded on the client. +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+). @@ -82,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 them in your application code: ``` js console.log(process.env.VUE_APP_SECRET) From 6ace1e9176858353cc11a6954424b0e520e5d12a Mon Sep 17 00:00:00 2001 From: Mohsen Sadeghzade Date: Wed, 24 Jul 2019 22:34:37 +0430 Subject: [PATCH 3/3] Update docs/guide/mode-and-env.md Co-Authored-By: Natalia Tepluhina --- docs/guide/mode-and-env.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/mode-and-env.md b/docs/guide/mode-and-env.md index 00e6d11d27..806a14c024 100644 --- a/docs/guide/mode-and-env.md +++ b/docs/guide/mode-and-env.md @@ -82,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 -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)