Closed zencm closed 2 years ago
Same issue for me also
On version 2.0.0 NODE_ENV usage has been removed because it is confusing since it is conflicting with webpack builder configuration set by the Angular CLI. NODE_ENV has been replaced with NG_APP_ENV which is set to NODE_ENV value by default but can be overridden.
Usge
NG_APP_ENV=development npm start
I would not recommend using NODE_ENV=development
for the same reason mention about Angular CLI internals.
Does that make sense to you? Let me know if there is a common use case I didn't think of.
I added this neat package (which works nicely in another project) to an existing project which has been migrated to angular 12 in the past.
When running
ng serve
, i.e. using the default environment, we get a slew of these warnings, without it affecting the app or .env functionality otherwise:Apparently the angular.json has an empty
"defaultConfiguration": ""
line and is also not invoked with a specific environment by default. Production builds do not have this issue, likely as that has a specific environment.The readme says that
NODE_ENV
should default to 'development', but in this case it is undefined, probably because {browserTarget.configuration
is also undefined. I changed dev-server/index.js to default to 'development':{ env: browserTarget.configuration || 'development' }
.…but I am not sure whether he warning is the intended behavior or our project setup is somewhat broken.