Ionic 4 environment

Hi! Iam building an app in ionic 4, using angular 7, in this version we have a file called “environment” that is replaced with “” when you use --prod command, i create the building in my local machine with:

ionic cordova build android --prod --release

And everithing works fine, the problem when i use Bitrise is, when i create a release version the environment that the aplication build use is not “”

Here my bitrise.yaml

format_version: ‘7’
project_type: ionic

  • push_branch: “*”
    workflow: primary
  • pull_request_source_branch: “*”
    workflow: primary
    • activate-ssh-key@4.0.3:
      run_if: ‘{{getenv “SSH_RSA_PRIVATE_KEY” | ne “”}}’
    • git-clone@4.0.14: {}
    • script@1.1.5:
      title: Do anything with Script step
    • certificate-and-profile-installer@1.10.1: {}
    • npm@1.0.1:
      • command: install
    • generate-cordova-build-configuration@0.9.6:
      • development_team: 8VH588FE4X
      • provisioning_profile: 7aada4df-8a4d-48ee-8801-56643e004a44
      • automatic_provisioning: ‘yes’
      • code_sign_identity: iPhone Distribution
      • package_type: ad-hoc
      • configuration: release
        is_always_run: true
    • ionic-archive@2.0.0:
      • options: '-- --prod --buildFlag="-UseModernBuildSystem=0" ’
      • platform: ios
    • deploy-to-bitrise-io@1.3.19:
      is_always_run: false
    • IONIC_PLATFORM: ios, android

Hello @ixcayau

Could you try with -- --buildFlag="--prod" --buildFlag="-UseModernBuildSystem=0"

Thanks for answering, i tried it but i got an error after creating the ionic compression (probably in this time gets the correct environment)

The error is appearing when ios build is created

xcodebuild: error: invalid option ‘–prod’

Another suggestion?

could you please send me the url of the build so I can check the full logs for some more info? :upside_down_face:

Of couse (using --buildFlag="–prod") (using --prod)

Hy so the problem with this is that the flag is added to the command in the wrong time I think :thinking:
it is not added to the ionis cordova build command, but to the xcodebuild command

Adding xcodebuildArg: --prod
xcodebuild: error: invalid option '--prod'

and this is valid, xcodebuild really does not have this argument :thinking:
Could you try to tun this build command in a script step?
also the example you gave is for android ionic cordova build android --prod --release
is it the same for iOS as well? :upside_down_face: ionic cordova build ios --prod --release

Yes, is the same, i was created a script and it works!!! Thanks for your help!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.