I’m having a problem with my CSS breaking when trying to build my capacitor project.
When I run the following command everything works: ionic cap run ios -l --external --open
But when I try to build (ionic cap build ios --prod) there seem to be a lot of styles missing.
For example: This is a ion-card from when I"m using ‘ionic cap run ios’:
But when I build using ‘ionic cap build ios --prod’ I’m seeing the following:
It is the same ion-card, but a lot of classes seem to be missing and the layout breaks. I’m also using Tailwind. I tried to remove Tailwind to see if that was the cause of the dissapearing classes, but that wasn’t the case.
Does anybody have an idea?
I was able to solve it by make a change in my ionic.config.json:
{
“name”: “MyApp”,
“integrations”: {
“capacitor”: {}
},
“type”: “angular-standalone”
}
I changed ‘type’ to ‘angular’:
{
“name”: “MyApp”,
“integrations”: {
“capacitor”: {}
},
“type”: “angular”
}
After this my problems were solved
Is your app an angular app or an angular-standalone app?
If it’s a standalone app and you changed the type it might cause other issues, better report the problem on Issues · ionic-team/ionic-cli · GitHub
You’re right, that caused problems in other screens. My app is indeed standalone, and I discovered the screen that was breaking was importing IonicModule from ‘@ionic/angular’ instead of importing the individual components from ‘@ionic/angular/standalone’, so that was the cause
1 Like