Prod tag removes some functionality


#1

Good Day,

A project that I’ve been working on recently seems to run into issues when using the --prod tag to build the apk files and the iOS equivalent. There is nothing in terms of error feedback, however, certain aspects of the application seems to be missing.

When testing it with the commands I believe --prod contains (–aot --minifycss --minifyjs --optimizejs) I manage to narrow the issue down to --minifyjs and --optimizejs. It seems that using these two options completely disrupts some of the applications dependencies (I think). Using --optimizejs causes the application to white screen after the splash is displayed, and using --minifyjs causes menu items and functionality to disappear.

To give an example of what happens, we have a menu, with page specific options, so page A has “Create something”, and page B has “Delete something”, and without --minifyjs, opening the menu on the specific pages yields the correct contextual options, but using the --minifyjs tag the contextual options are missing from the menu. Everything else in the application works as it’s supposed to, but the ViewController in the popup menu seems to not be able to determine which page it’s being called from.

Any help on the matter would be much appreciated.

Thanks.


#2

Anyone had any experience?


#3

Are you doing anything in your code that relies on class names? Are you using lazy page loading?


#4

Not in the page that’s affected. We used a popover menu, with contextual options based on what page you’re on, and using --prod basically removes the contextual options for all the pages, so the menu only shows the default menu options.


#5

I would have to see the code to say much more, but if you are doing something like this thread, minification will break it. Generally I find “based on what page you’re on” logic very hard to read and maintain, so I do my best to avoid it.


#6

That’s very similar to what we’ve been doing, will give it a read, thanks for replies.


#7

We have the same issue and we could narrow it down to --minifyjs as well.

In our case, the storage plugin does not work properly and events like (ionBlur) or (keyUp) don’t fire anymore.

<ion-input type="text" (ionBlur)="checkValid()" [(ngModel)]="address.name" placeholder="Location Name"></ion-input>

Without --prod or --minifyjs, or in the Browser, everything works like a charm.

I found this:
“It also ignores plugins/imports which you have included but haven’t used.” in this post and that got me curious.

Maybe it ignores some of the dependencies, as you mentioned as well, but we are still not able to solve this problem :confused: If you found something out, please let me know!

Edit: With ionic 3.6.0 and the same code, everything worked as well. With 3.9.2 it doesn’t.