Ionic 5 --prod build fails

Hello, I’m creating a PWA using Ionic but I cant build it for prod.

   Ionic CLI                     : 5.4.16 
   Ionic Framework               : @ionic/angular 5.6.6
   @angular-devkit/build-angular : 0.1102.13
   @angular-devkit/schematics    : 11.2.13
   @angular/cli                  : 11.2.13
   @ionic/angular-toolkit        : 3.1.1

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v10.13.0
   npm    : 6.4.1
   OS     : macOS Catalina
ionic build --prod

It logs errors regarding ionic templates
For example:
Screen Shot 2021-05-24 at 12.11.04 AM

Here is my components.module.ts.
Screen Shot 2021-05-24 at 10.49.34 AM

I already have the IonicModule for the components but I am still having this issue

I also tried creating a new app with some component and with same dependencies, and it successfully build it in prod.

I also tried removing node_modules and doing npm i again

Upon checking, the components where the errors were encountered are not included in the components array of the components.module.ts