You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/shared/guides/define-environment-variables.md
+26-3Lines changed: 26 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ Environment variables are useful to store system-wide values such as the directo
5
5
(PATH), OS version, Network Information, and custom variables. These env variables are passed at build time and used at
6
6
the runtime of an app.
7
7
8
-
## Setting environment variables
8
+
## Set Environment Variables
9
9
10
10
By default, Nx will load any environment variables you place in the following files:
11
11
@@ -53,15 +53,38 @@ We recommend nesting your **app** specific `env` files in `apps/your-app`, and c
53
53
for workspace-specific settings (like the [Nx Cloud token](/ci/recipes/security/access-tokens)).
54
54
{% /callout %}
55
55
56
-
### Pointing to custom env files
56
+
### Environment Variables for Configurations
57
+
58
+
Nx will only load environment variable files for a particular configuration if that configuration is defined for a task, even if you specify that configuration name from the command line. So if there is no `development` configuration defined for the `app`'s `build` task, the following command will use `.env.build` instead of `.env.build.development`:
59
+
60
+
```shell
61
+
nx build app --development
62
+
```
63
+
64
+
In order to have Nx actually use the `.env.build.development` environment variables, the `development` configuration needs to be set for the task (even if it is empty).
0 commit comments