Ionic Services - Package/Cloud build does not respect the --prod flag


#1

Hi,

This morning I was building apps in PROD mode in Ionic cloud and they were 4 megs. This afternoon, they are now 7megs and it’s using the wrong environment variable, hence it’s using my Dev settings, not my Prod settings. However they ARE signed with the correct PROD certificate as the App Store won’t let you upload an APK file that is in debug mode.

When I do a local Android platform build it is 4 megs. It’s only when I use Ionic Cloud it seems that minification and AOT is NOT working.

I can view the “release” build with GapDebug I can see it is not minfied. Here is the code I use in the CLI:
ionic package build android --profile prod --prod --release

I don’t think I have changed anything on my side - is anyone else experiencing Ionic Cloud Build issues in prod mode?

To summarise:

Cordova CLI: 6.5.0
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.2.2
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.0
Xcode version: Not installed

PS - I can narrow down the time to when it started - I did 2 iOS builds 20 minutes apart which took the same time to build (you can see them here: https://www.screencast.com/t/vwbrpM4o4bhV)

The earlier one is 4 megs and the one 20 min later jumped to over 7megs - both in Release mode. This was at 7:46pm UTC time (30/3/17) if that helps.


Ionic Cloud - Ionic Package
#2

Good (or bad, depending :wink: - I just did another build with the exact same command (no changes at all in GIT) and now it’s working again - back down to 4 megs and minified…

ionic package build android --profile prod --prod --release

I suggest someone from the Ionic Cloud Build team investigate this - I can help if neccessary - it was definitely an issue in the cloud build for a few hours…


#3

Ok, after an hour of working it is now not working again…


#4

Is anyone using the Cloud Build service? It has not been working the whole day and is still broken?


#5

Well, after another 30 identical incorrect builds in DEV mode this morning I woke up and tried again and now it is correctly building in PROD mode.

This is a major bug which kinda renders it useless. It is apparent that no one is actually using this Ionic Cloud and there’s been no answer to any of my support calls which is disappointing.


Can't package build ios production
#6

I am using the cloud build - however still in development mode so have not yet fully tested release builds.


#7

Ok, thanks - let me know if you do test a PROD build. I have some theories now on what might be happening - I just need to prove it - possible you need to run an Ionic Serve --Prod before doing the PRod Cloud Build - I am not sure if it is something to do with the www folder. Very sporadic though - this morning it is working again but last time it only minified the prod code for an hour or so before going back to Dev mode.


#9

FYI: This is still not working. It is impossible to build PROD builds using Ionic Cloud.


#10

I got the exact same problem on my side : sometimes Ionic Package seems to use the --prod flag correctly, sometimes not. This is very problematic because it multiply the launch time per two which is not acceptable for client. Manual build is then the fallback…


#11

Thank goodness someone else has experienced this - I thought I was going crazy. Out of 100 builds it only works 5 of the times for me, and completely randomly (with no source changes on my side). Unfortunately I don’t have a Mac so cannot proceed with releasing my application (iOS rejected my first attempt - go figure!) - only Android works…


#12

Did you report this issue on https://github.com/driftyco/ionic-cloud-issues/issues?

And just to make sure I understood:
(As there are too many similar terms in this space: prod, prodution, dev, release, build, package…)

  • There seems to be a bug/problem with Ionic Package.
  • The problem is that the builds sometimes ignore the --prod parameter that activates minifying etc.
  • (Command used is e.g. ionic package build android --profile prod --prod --release)
  • The symptom is a much bigger file as a result.

Does this only happen with --release or also without?
Does it only happen on production security profiles or also on development security profiles (--profile)?
Do you see any difference on the uploads that match the build on the Ionic Deploy Tab?


#13

I reported it in 4 places: Here, the Ionic Cloud GitHub (https://github.com/driftyco/ionic-cloud/issues/195), emailed Support and on the Slack channel.

Answering your questions in order:

  1. Yes (only the CLOUD build is affected)
  2. Correct
  3. Yes, however can be android or ios - neither work
  4. Yes. I noticed that it IS using the correct Environment file (Prod)- not my Dev Environment file as stated in my original post - I will update this

Let me get back to you on the last 3 questions - I have just started an upgrade to Ionic 3 so everything is in limbo.


#14

Try the one I provided. This is probably not a problem with the ionic cloud client (where you reported the issue on github). And don’t just link to the forum post but include all necessary information in a structured way that is easy to grasp.

This piece is call “Ionic Package” or “Ionic Cloud Package”. It is the online/cloud version of the CLI command ionic build. (Easier if you use the common wording for things, otherwise people won’t really know what you are talking about)


#15

I honestly thought my original post at the top of this form was pretty comprehensive. It seems very anti-intuitive to duplicate an entire post into another forum and then have to maintain it in 2 places or more places.

However, considering I have had no luck so far I will try your advice on all fronts.


#16

Haha, I guess there is another option now:
https://ionic.zendesk.com/hc/en-us/requests/new

(Also seems “Ionic Cloud” is now called “Ionic Services”…)

(Just got a link to this as response to one of my own issues:
https://github.com/driftyco/ionic-cloud-issues/issues/292#issuecomment-292235254)


#17

Hehe - I’ll try the ZenDesk approach as well… just successfully upgraded to ng4, Ionic3, Ionic Native Cloud3 so will try it all again - what fun :wink:


#18

Ok, here are the answers to these 3 questions:

  1. It happens with or without --release flag (the only difference is in the cloud window the build does not have (release)
  2. It’s the same size, however it took longer to build (ie. no discernible difference)
  3. No, they all look the same (Metadata/versioning etc)

ps - @Sujan12 I appreciate the help :wink: I raised this issue with Ionic on their new Zendesk.forum - hopefully someone from the core team will see it.


#19

@rodneyjoyce Is this still the case? I was previously using cloud build only but got a local project set up etc and noticed that --prod significantly reduced startup time (20s -> 7s on a very basic 4.4.1 tablet) with my local build, but ionic package builds are the same size with or without prod, and the same size as a local non --prod build.

ionic-cloud-issues seems to be gone.


#20

I don’t actually really know how ionic package works internally, but I got an idea/hunch:
What version of your app do you currently have in /www? You can build the app locally via npm run build or npm run build --prod. Would be great if you could check if this has any influence…


#21

Your hunch seems to be correct.
I had unminified files in /www/build, and ran ionic package (–release --prod), producing APK1.
I then ran “ionic serve --prod” as a test, but still had unminified files so I assume serve doesn’t care about --prod. I ran “ionic build browser --prod” which left minified files in /www/build. Then I ran ionic package again, created APK2.
APK1 starts in 20s, APK2 is a bit smaller and starts in 7s.

Not the ideal situation but quite helpful to know. It seems like the issue is possibly then in the ionic-app-scripts not minifying etc before uploading (when using --prod) when using ionic package.