Reputation: 6121
I have an ionic cordova angular app that I'm trying to build for different environments (prod vs local)
In the environments there's a file environment.prod.ts with the prod connection strings
and the following is in my angular.json file describing the environment
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
When I actually build with the below command though, it does not do the file replacement but just uses what's already in the plain environment.ts file
ionic cordova build browser -- -c=production
I also tried --env=production and a whole slew of other varieties. Am I missing a setting somewhere? Or what
Upvotes: 3
Views: 831
Reputation: 2690
It works for me with:
ionic cordova build browser --prod
If you need more complex environments you can create a build.json and run it like:
ionic cordova build browser --buildConfig=build.json
for other environments rather than production:
ionic build -c=environment --engine=cordova --platform=browser
Upvotes: 3