Comments (4)
That's right, that happens because you run the application using nx command (with a target); when doing that nx does read the .env file and populates process.env before running the @ngx-env/builder, when he builder is run it won't override the env var since already present in process.env.
If you run the builder directly (wihtout using the nx command), you won't have the issue.
The only workaround is to name .env files differently so that nx does not seem them, for example .env.app or the like, you can specify the list of files using the "files".
There is a nx working example in the examples folder.
from ngx-env.
I am not able to reproduce the issue.
Could you please test in a freshly generated angular project? If you can reproduce it, it would helpful to share that repo.
Thanks for your feedback.
from ngx-env.
On a fresh nx install I cannot reproduce the problem either but on my project if I'm switching between 16.0.2 and 16.1, it works / it does work, that is weird... I have noticed that dotenv
dependencies have changed between those versions but I can't understand what causes my trouble.
from ngx-env.
@chihab I think I spotted the issue: the expansion does not work in the .env
located at the root of the (nx) workspace, if I copy the .env
file to the sources of the application then it works.
from ngx-env.
Related Issues (20)
- Problem with module federation HOT 2
- I cannot access my environment variables in my environment.ts HOT 2
- version info for import.meta.env HOT 1
- Thank you for making this HOT 1
- environment variables not being set HOT 2
- ng build throws rxjs switchmap error HOT 5
- Do the `secret` keys get included in the final build? HOT 2
- Document usage with custom builder and @dotenv-run/webpack
- Prepare stackblitz playground
- Support angular workspace for ng-add
- Angular 17 support HOT 8
- Issue while building with v17 when SSR is disabled HOT 10
- Replace variables on pre-rendered pages HOT 4
- Design a logo
- @ngx-env not loading variables HOT 6
- Schema validation failed on `ng serve` HOT 7
- @ngx-env/builder Mistargets File Path for index.server.html. ( Nx + Angular ) monorepo HOT 4
- Add browser-esbuild builder HOT 2
- how to apply Env Vars to multiple npm scripts HOT 3
- @ngx-env not working with `localize` option in SSR HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-env.