Search code examples
ionic-frameworkbrowserionic4

How to make Ionic 4 build for a browser?


I’m unfortunately having difficulty deploying my ionic project for web. No matter what I do, commands such as 'ionic build, ‘ionic build --prod’, ‘ng build --prod’, or whatsoever always create a www folder that is incorrect. The index.html in this www folder is always blank when viewed from a browser.

I’ve tested this issue on other ionic projects as well (just generated some from templates) and the same issue occurs here, with the index.html in the www folder always being displaying a blank site. If possible, I’d appreciate any help if that’s OK!


Solution

  • ionic cordova platform add browser
    ionic cordova run browser
    ionic cordova build browser --prod
    

    For testing purpose use ionic serve . It will rebuild automatically every time when you update your code.