Troubleshooting --prod build

I have an Ionic 2 code that works perfectly when you build it without “–prod” and breaks with it.

The code simply makes an http post request and converts the result to promise., { … }, { … }).toPromise();

When I run it in the prod mode the promise is rejected and I reach my catch method without any data in it’s parameter…
I can confirm that the http request is successful and returns identical data to when called without the “–prod” flag.

Debugging JS is not feasible as the code has been compiled and minified.
How would you troubleshoot such an issue?

Could you share any more code?
It’s hard to know whats going on from just the pseudo sample code

hi @mhartington,

Thanks for your response.
It was more of a general question on how you could troubleshoot such an issue.

With google closure, for example, there are flags that you can pass to the compiler that make your code obfuscated but still readable, e.g --formatting PRETTY_PRINT --debug

Is there anything similar to that in the ionic build process?

Regarding my specific case I spent some time debugging this with good old alerts.

The error was actually caused by an exception inside then(…) block so it had nothing to do with http.
Did not know that this is how Promises behave, sorry for the confusion.

Anyway, the reason for the error was the Toast plugin from ionic native…
When I call it without --prod flag it works but fails with “plugin_not_installed” message in prod mode.
Any ideas?