Error on ionic elements only in --prod

Hi, I have a ionic-angular application with cordova integration. It has a sidemenu which is in the app component. When i run ionic cordova build android , ionic build, npm run build it is working fine. But when i run ionic build --prod, it shows me error in app component.html that the ionic elements are unknown. I’ve imported ionic module. I’ve even tried with sidemenu as a seperate component and importing it in app module. Eventhough i get this error. This is strange. :frowning: help me asap.

My Ionic Info

Ionic:

Ionic CLI : 6.11.0

Utility:

cordova-res : 0.15.1
native-run : 1.0.0

System:

NodeJS : v12.18.0
npm : 6.14.4
OS : Windows 10

The error showing is
ERROR in ‘ion-icon’ is not a known element:

  1. If ‘ion-icon’ is an Angular component, then verify that it is part of this module.

  2. If ‘ion-icon’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message. ("


    {{userno}}
    [ERROR ->]


    </")
    ‘ion-menu-toggle’ is not a known element:
  3. If ‘ion-menu-toggle’ is an Angular component, then verify that it is part of this module.

  4. If ‘ion-menu-toggle’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message. ("

    <div class=“profile_box” (click)=“my_profile()”>
    [ERROR ->]

    Hey


    {{username}}


    ")
    ‘ion-header’ is not a known element:
  5. If ‘ion-header’ is an Angular component, then verify that it is part of this module.

  6. If ‘ion-header’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message. (“n-split-pane contentId=“main-content”>

    [ERROR ->]
    <div class=“profile_box” (click)=“my_profile()”>
    <ion-menu-toggle auto”)
    Can’t bind to ‘routerLink’ since it isn’t a known property of ‘ion-item’.

  7. If ‘ion-item’ is an Angular component and it has ‘routerLink’ input, then verify that it is part of this module.

  8. If ‘ion-item’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message.

  9. To allow any property add ‘NO_ERRORS_SCHEMA’ to the ‘@NgModule.schemas’ of this component. (" appPages; let i = index">
    <ion-item (click)=“selectedIndex = i” routerDirection=“root” [ERROR ->][routerLink]="[p.url]" lines=“none” detail=“false” [class.selected]=“selectedIndex == i”>
    ")
    ‘ion-icon’ is not a known element:

  10. If ‘ion-icon’ is an Angular component, then verify that it is part of this module.

  11. If ‘ion-icon’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message. (“class.selected]=“selectedIndex == i”>


    [ERROR ->]

    “)
    The pipe ‘translate’ could not be found (“art” class=”{{p.icon}}”>

    {{ [ERROR ->]p.title | translate}}


    {{ p.sub_title | translate}}


    </")
    The pipe ‘translate’ could not be found ("

    {{ p.title | translate}}


    {{ [ERROR ->]p.sub_title | translate}}




    ")
    ‘ion-item’ is not a known element:
  12. If ‘ion-item’ is an Angular component, then verify that it is part of this module.

  13. If ‘ion-item’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message. (" <ion-menu-toggle auto-hide=“false” *ngFor=“let p of appPages; let i = index”>
    [ERROR ->]<ion-item (click)=“selectedIndex = i” routerDirection=“root” [routerLink]="[p.url]" lines=“none” deta")
    ‘ion-menu-toggle’ is not a known element:

  14. If ‘ion-menu-toggle’ is an Angular component, then verify that it is part of this module.

  15. If ‘ion-menu-toggle’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message. ("


    [ERROR ->]<ion-menu-toggle auto-hide=“false” *ngFor=“let p of appPages; let i = index”>
    <ion-item (")
    Can’t bind to ‘ngForOf’ since it isn’t a known property of ‘ion-menu-toggle’.

  16. If ‘ion-menu-toggle’ is an Angular component and it has ‘ngForOf’ input, then verify that it is part of this module.

  17. If ‘ion-menu-toggle’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message.

  18. To allow any property add ‘NO_ERRORS_SCHEMA’ to the ‘@NgModule.schemas’ of this component. (“creen>

    <ion-menu-toggle auto-hide=“false” [ERROR ->]*ngFor=“let p of appPages; let i = index”>
    <ion-item (click)=“selectedIndex = i” routerDi”)
    Property binding ngForOf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the “@NgModule.declarations”. ("


    [ERROR ->]<ion-menu-toggle auto-hide=“false” *ngFor=“let p of appPages; let i = index”>
    <ion-item (")
    ‘ion-list’ is not a known element:

  19. If ‘ion-list’ is an Angular component, then verify that it is part of this module.

  20. If ‘ion-list’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message. ("

    [ERROR ->] <ion-menu-toggle auto-hide="false" *ngFor="let p of")

‘ion-content’ is not a known element:

  1. If ‘ion-content’ is an Angular component, then verify that it is part of this module.

  2. If ‘ion-content’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to
    suppress this message. ("

    [ERROR ->]

    <ion-menu-toggle a")
    ‘ion-menu’ is not a known element:

  3. If ‘ion-menu’ is an Angular component, then verify that it is part of this module.

  4. If ‘ion-menu’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message. ("
    [ERROR ->]

    <div class=“profile_box”)
    ‘ion-split-pane’ is not a known element:

  5. If ‘ion-split-pane’ is an Angular component, then verify that it is part of this module.

  6. If ‘ion-split-pane’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component
    to suppress this message. (" [ERROR ->]

    ")

[ERROR] An error occurred while running subprocess ng.

All these lines are from sidemenu component. I’ve included Ionic Module in the component’s module and imported the same module in app module also.