Skip to content

Commit

Permalink
chore: merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
sodatea committed Apr 1, 2020
2 parents 0051017 + d41f31c commit 960400b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
6 changes: 3 additions & 3 deletions docs/dev-guide/plugin-dev.md
Expand Up @@ -251,7 +251,7 @@ First, we need to read main file content with Node `fs` module (which provides a
module.exports.hooks = (api) => {
api.afterInvoke(() => {
const fs = require('fs')
const contentMain = fs.readFileSync(api.entryFile, { encoding: 'utf-8' })
const contentMain = fs.readFileSync(api.resolve(api.entryFile), { encoding: 'utf-8' })
const lines = contentMain.split(/\r?\n/g)
})
}
Expand All @@ -265,7 +265,7 @@ Then we should to find the string containing `render` word (it's usually a part
module.exports.hooks = (api) => {
api.afterInvoke(() => {
const fs = require('fs')
const contentMain = fs.readFileSync(api.entryFile, { encoding: 'utf-8' })
const contentMain = fs.readFileSync(api.resolve(api.entryFile), { encoding: 'utf-8' })
const lines = contentMain.split(/\r?\n/g)
const renderIndex = lines.findIndex(line => line.match(/render/))
Expand All @@ -283,7 +283,7 @@ module.exports.hooks = (api) => {
api.afterInvoke(() => {
const { EOL } = require('os')
const fs = require('fs')
const contentMain = fs.readFileSync(api.entryFile, { encoding: 'utf-8' })
const contentMain = fs.readFileSync(api.resolve(api.entryFile), { encoding: 'utf-8' })
const lines = contentMain.split(/\r?\n/g)
const renderIndex = lines.findIndex(line => line.match(/render/))
Expand Down
14 changes: 10 additions & 4 deletions docs/guide/mode-and-env.md
Expand Up @@ -43,10 +43,16 @@ An env file simply contains key=value pairs of environment variables:

```
FOO=bar
VUE_APP_SECRET=secret
VUE_APP_NOT_SECRET_CODE=some_value
```

Note that only variables that start with `VUE_APP_` will be statically embedded into the client bundle with `webpack.DefinePlugin`.
::: warning
Do not store any secrets (such as private API keys) in your app!

Environment variables are embedded into the build, meaning anyone can view them by inspecting your app's files.
:::

Note that only `NODE_ENV`, `BASE_URL`, and variables that start with `VUE_APP_` will be statically embedded into the *client bundle* with `webpack.DefinePlugin`. It is to avoid accidentally exposing a private key on the machine that could have the same name.

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+).

Expand Down Expand Up @@ -87,10 +93,10 @@ In both cases, the app is built as a production app because of the `NODE_ENV`, b
You can access env variables in your application code:

``` js
console.log(process.env.VUE_APP_SECRET)
console.log(process.env.VUE_APP_NOT_SECRET_CODE)
```

During build, `process.env.VUE_APP_SECRET` will be replaced by the corresponding value. In the case of `VUE_APP_SECRET=secret`, it will be replaced by `"secret"`.
During build, `process.env.VUE_APP_NOT_SECRET_CODE` will be replaced by the corresponding value. In the case of `VUE_APP_NOT_SECRET_CODE=some_value`, it will be replaced by `"some_value"`.

In addition to `VUE_APP_*` variables, there are also two special variables that will always be available in your app code:

Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-plugin-eslint/README.md
Expand Up @@ -17,7 +17,7 @@
--max-warnings specify number of warnings to make build failed (default: Infinity)
```

Lints and fixes files. If no specific files are given, it lints all files in `src` and `test`.
Lints and fixes files. If no specific files are given, it lints all files in `src` and `tests`.

Other [ESLint CLI options](https://eslint.org/docs/user-guide/command-line-interface#options) are also supported.

Expand Down

0 comments on commit 960400b

Please sign in to comment.