Cannot determine the module for class X in X.ts! Add X to the NgModule to fix it error in ionic2

前端 未结 4 1486
无人共我
无人共我 2020-12-17 19:26

I am facing an issue when I try to build my app using the following command :

ionic cordova run android --prod --release

Everything runs fine if

相关标签:
4条回答
  • 2020-12-17 19:34

    This could also be a filename casing problem. see https://github.com/angular/angular-cli/issues/10732

    0 讨论(0)
  • 2020-12-17 19:34

    elaborating on answer by @[Thom Kiesewetter]

    It could also be a path casing issue reference used in the module or in routes or anywhere else

    e.g path was

    import { EmployeeComponent } from "./Entities/employee.component";

    instead of

    import { EmployeeComponent } from "./entities/employee.component";

    where the real path was "entities" and not "Entities"

    0 讨论(0)
  • 2020-12-17 19:40

    Changed declarations to pages like below and it worked.

    declarations: pages
    

    I got the answer at :https://forum.ionicframework.com/t/error-while-running-the-ionic3-app-in-production-mode/106294

    0 讨论(0)
  • 2020-12-17 19:53

    I had the same problem , but for me, two components with the same name were there something like below,

    my-first-app\src\app\header\header.component.ts

    my-first-app\src\header\header.component.ts

    the second one is unused and wrongly placed as all my codes were inside my-first-app\src\app only. I removed the second one and it resolved my issue.

    0 讨论(0)
提交回复
热议问题