Can I run ionic serve with a minified build?


#1

I am am starting to struggle on how to diagnose a startup issue I have when running a production build on Android as reported in this post.

I have not tried the production build on any other platform yet, so not sure if I am going to have the same problem on iOS and in a UWP, but thought perhaps if I could run a minified build via ionic serve , or some other way, so I can run it within Chrome on my desktop perhaps I might get some hint of the error in the dev console. I am just guessing that maybe it’s the minification that is causing the problem, as I only get it when using the --prod flag (using just --release without the --prod I do not get the issue.

I’ve had a look at build scripts topic, but can’t quite see how to do what I am after.

Any ideas on how to run a minified version of the application on my desktop Chrome would be hugely appreciated, as I am running out of ideas on how to get to the bottom of this.

Thanks in advance for any suggestions!


How to diagnose white screen on startup on Android device
#2

The very first reply to your other topic explained exactly how to debug on a device by attaching Chrome’s developer tools to it. That seems like a much better option to me.


#3

Ok, I finally found what to do. It is just a simple command line flag --prod is picked up when I do the run command

ionic serve --prod does not work, but using the device and chrome tools I can run

ionic run android --prod

… and now I can the error in the dev tools , which is…

   		 Uncaught Error: Cannot find module "./app.module.ngfactory"
		at Object.<anonymous> (main.js:7)
		at e (main.js:1)
		at main.js:1
		at main.js:1

This now probably belongs in my original post so I will continue it there.


#4

The combination --prod and --release did the thing for me:
npm run ionic:build --prod --release