Skip to content

Commit

Permalink
docs: add note about using define in envPrefix config (#12347)
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Mar 10, 2023
1 parent 86a24e4 commit f89f12a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/config/shared-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,15 @@ Env variables starting with `envPrefix` will be exposed to your client source co

:::warning SECURITY NOTES
`envPrefix` should not be set as `''`, which will expose all your env variables and cause unexpected leaking of sensitive information. Vite will throw an error when detecting `''`.

If you would like to expose an unprefixed variable, you can use [define](#define) to expose it:

```js
define: {
'import.meta.env.ENV_VARIABLE': JSON.stringify(process.env.ENV_VARIABLE)
}
```

:::

## appType
Expand Down

0 comments on commit f89f12a

Please sign in to comment.