Building Ionic2 app for browser

npm run ionic:build --prod

You don’t need to add browser as a platform. That’s a confusing topic… it’s something you only need to do if you plan to use Cordova’s browser plugins. Here’s a quick rule of thumb:

If you successfully built you app without already adding the browser platform, you don’t need to include it at all. That’s because you add platforms at the beginning, as you start coding.

Also, by adding the --prod switch, even if you did add browser by accident, all of the unused libraries (Cordova included) will be removed from your production code.

After you run the build command, go to your www directory, and deploy the contents to your server.

Good luck,
Ryan

17 Likes