Skip to content

Commit 7d99c44

Browse files
NataliaTepluhinahaoqunjiang
authored andcommitted
docs: add a code sample for computed env variables declaration (#3046) [ci skip]
Fixes #2864
1 parent 1f5f7c3 commit 7d99c44

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docs/guide/mode-and-env.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,15 @@ In addition to `VUE_APP_*` variables, there are also two special variables that
8686
All resolved env variables will be available inside `public/index.html` as discussed in [HTML - Interpolation](./html-and-static-assets.md#interpolation).
8787

8888
::: tip
89-
You can have computed env vars in your `vue.config.js` file. They still need to be prefixed with `VUE_APP_`. This is useful for version info `process.env.VUE_APP_VERSION = require('./package.json').version`
89+
You can have computed env vars in your `vue.config.js` file. They still need to be prefixed with `VUE_APP_`. This is useful for version info
90+
91+
```js
92+
process.env.VUE_APP_VERSION = require('./package.json').version
93+
94+
module.exports = {
95+
// config
96+
}
97+
```
9098
:::
9199

92100
## Local Only Variables

0 commit comments

Comments
 (0)