-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docs file for environment variables
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
title: "Environment Variables" | ||
--- | ||
|
||
You can easily provide environment variables to your site. Just add a `.env.development` and/or `.env.production` file in your root folder for development or production builds respectively. The environment variables are embedded during build time using Webpack's [DefinePlugin](https://webpack.js.org/plugins/define-plugin/). Because these variables are provided at build time, you will need restart your dev server or rebuild your site after changing them. | ||
|
||
## Example | ||
|
||
``` | ||
# Example .env.development file | ||
API_URL=https://dev.example.com/api | ||
``` | ||
|
||
``` | ||
# Example .env.production file | ||
API_URL=https://example.com/api | ||
``` | ||
|
||
These variables will be available to your site as `process.env.API_URL`. | ||
|
||
> You can not override certain environment variables as some are used internally for optimizations during build | ||
Reserved environment variables: | ||
|
||
- `NODE_ENV` | ||
- `PUBLIC_DIR` |