Similar to an Angular 14 generated project I want to have separate development and production environments but when creating a project using ng new
:
ng new my-app
this does not create the environments folder or set this up.
See Angular - Configure Environment Specific Defaults
EDIT:- As predicted, GitHub Issue
After the release of Angular CLI 15.1, a generation schematic will be available to add environment files for all existing build configurations within a project. Example usage:
ng g environments
To manually create:
If you want to recreate environments, follow these steps:
Create environments
directory
Create your custom environments
environment.ts
environment.prod.ts
environment.staging.ts
etc.Update your angular.json
or project.json
to do fileReplacements
where the paths are from project root to the environment file for replace
and with
:
"configurations": {
"production": {
...
"fileReplacements": [
{
"replace": "apps/some-app/src/environments/environment.ts",
"with": "apps/some-app/src/environments/environment.prod.ts"
}
],
},
"development": {
...
}
},
"defaultConfiguration": "production"
},