TL;DR: Nothing!
Angular 15 simply doesn't ship anymore environment files by default.
You can still create them and configure their repla...
For further actions, you may consider blocking this person and/or reporting abuse
Angular needs to get rid of this and add
.env
support out of the box IMHO. Globals are something else.Hi jonathan.
How would you like dotenv to be integrated natively in Angular?
Good question. I'm not sure, but it is in all other frameworks. It works with the Webpack version of Angular, but that is overkill just for env variables. At the very least, it should work natively with Universal.
I got no experience with dotenv or Universal, so maybe I'm missing something basic:
what issue do you face if you try to prepone a script loading the .env, inside build script of your package manager?
It doesn't work. Here is just one article on how to hack it - indepth.dev/tutorials/angular/inje...
Right.
Now I get it.
That really old ticket linked in the article suggests a lot of solutions, but looks like none of them has still been accepted and integrated into cli.
Nice article! Thanks for the mention! β₯οΈ
Thanks to you.
Your post has been really useful.
Really a good articleπ! One stop solution for all the information one might need about the topic.
Thanks.
I'm glad it's been helpful for you.
It's strange how a "highly-opinionated" framework like Angular will suddenly punt on its "highly-opinionated" solution. Their solution provided convenience (as does their whole product). Why use their framework, if not for convenience? God knows it's hard enough to use as it is.
Hi ptletski.
Not sure I get where's the ambiguity.
The choice of environment files in the beginning was forced by circumstances.
Once those were gone, they dropped default use of the files.
In this case, the whole setup was not due to opinion, but to necessity.
why does angular put us in the trouble of replacing environments when they were so easy to use? What a desire to annoy the user!
How do I know, in the application, what build mode I am in?
Hi Julio.
None has been obliged to use a different system.
As explained in the article, old environment files replacement per-build works as usual, and since 15.2 they can be even generated on demand with a schematic.
The reason for them not being default anymore is the point of the whole article. :-)
About the last question, I'm not sure if I get it: why should you care about the build mode you're in?