mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
docs: add note that .env
is not read in production (#4714)
This commit is contained in:
parent
68384b58f4
commit
ff60e9f97c
@ -33,10 +33,15 @@ console.log(runtimeConfig.public.apiBase)
|
||||
### Environment Variables
|
||||
|
||||
The most common way to provide configuration is by using [Environment Variables](https://medium.com/chingu/an-introduction-to-environment-variables-and-how-to-use-them-f602f66d15fa).
|
||||
|
||||
::alert{type=info}
|
||||
Nuxt CLI has built-in [dotenv](https://github.com/motdotla/dotenv) support.
|
||||
|
||||
In addition to any process environment variables, if you have a `.env` file in your project root directory, it will be automatically loaded into `process.env` and accessible within your `nuxt.config` file and modules.
|
||||
|
||||
However, **after your project is built**, you are responsible for setting environment variables when you run the server - your `.env` file will not be read at this point.
|
||||
::
|
||||
|
||||
Runtime config values are automatically replaced by matching environment variables at runtime. For this to work, you _must_ have a fallback value (which can just be an empty string) defined in your `nuxt.config`.
|
||||
|
||||
**Example:**
|
||||
|
Loading…
Reference in New Issue
Block a user