Ionic 4 cannot build for browser

Hi all, 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!

have you tried ionic serve? like this documentation?

1 Like

Can you explain more about how you are trying to deploy the app and what exact process causes the “blank” page? I’m specifically interested in the URL being used - if it’s anything other than /, you are likely going to have to concern yourself with the baseHref and deployUrl options in angular.json.

1 Like

Managed to get it fixed, thank you guys! It seems that my issue was due to an incorrect server.js file (the console.log kept spitting out an error about incorrect MIME types) and the fact that I was opening the www folder directly by opening the index.html folder instead of using ionic serve inside. baseHref is still ‘/’ and seems to work, believe it was just me mistakenly not using ionic serve/writing a bad server.js file

1 Like