Han Che
Han Che

Reputation: 8519

ionic 4 - ionic cordova build android --prod doesn't copy angular environment.prod to environments

I want to use the settings in enviroments.prod.ts to build my android production build with ionic 4.

in angular.json under the configuration section, the replacement is defined

        "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true
            },

However when I run ionic cordova build android --prod

the environment doesn't get copied.

Upvotes: 2

Views: 518

Answers (1)

Adrita Sharma
Adrita Sharma

Reputation: 22213

Try this:

ionic cordova build android --prod --release

Upvotes: 2

Related Questions