Open atollk opened 3 months ago
What version of the package are you using please?
I'm using 17.3.0.
The environment follows this rule:
process.env.NG_APP_ENV || // @deprecated
process.env.NODE_ENV || // default in @dotenv-run/core
builderConfiguration // the angular build configuration
Example: if you set NODE_ENV the builder configuration is ignored if NG_APP_ENV and NODE_ENV are not set, then the builder configuration is picked.
Would it be possible to provide a repo reproducing the issue (you can fork it on stackblitz from here: https://stackblitz.com/edit/ngx-env-3ey8js)
Which builder are you using: application, browser-esbuild or browser?
Sorry, I didn't have the time to build a new example from the Stackblitz. I tried to reduce my own project to a small reproducible example.
I am running export NODE_ENV=production && npx nx run chess2-web:serve:development
. The builder output is what would be intended:
- Files: .env
- Environment: production
- Environment files:
✔ /home/x/Projects/git/chess-2.0/web/.env.production
✔ /home/x/Projects/git/chess-2.0/web/.env
- Environment variables: NG_APP
✔ NG_APP_FOO
---------------------------------
But the page is rendered as:
NG_APP_FOO: DEV
NG_APP_ENV:
NODE_ENV: development
So to me it seems like there are two issues here:
Hi. First of all, thanks for creating the project and keeping it active. It's a good addition that Angular is lacking.
I am trying to inject different configurations into my Angular application with @ngx-env/builder. However, it seems that the env files are not loaded correctly. I am running
myapp:serve:development
. This is the output when building:Seems valid to me. However,
NG_APP_BACKEND_API_URL
does not actually have the value that is defined in.env
, as it is suggested by that console log, but rather the value that is defined in a separate.env.development
. If I delete the latter, then the correct value is used.On the other hand, if I run
NODE_ENV=devxx myapp:serve:development
, this is the output:Again, completely reasonable and what I would expect. But again, that's actually not showing the truth:
env.devxx
is completely ignored and the values from.env
are used.So, apparently
NODE_ENV
is used only for logging but for the actual values, the angular build configuration is used?