【发布时间】:2020-10-16 19:50:04
【问题描述】:
当我编译我的应用程序时
ng build --prod
我有这个错误
ERROR in : Cannot determine the module for class AppComponent in D:/desarrollos/PatientPortal/front/src/app/customizations/database/app.component-database.ts! Add AppComponent to the NgModule to fix it.
但如果它编译使用
ng build --configuration=prod
编译正常,我的应用运行正常。
我看到不同之处在于第一个是使用 AOT 选项编译,但我不知道为什么会出现此错误,也不知道它是否重要(可能是关于我拥有的扩展类,但是对我很重要)。你能帮帮我吗?
【问题讨论】:
-
您在哪个模块中声明了
AppComponent?并且不要将它与默认的AppComponent混淆。也许从/app.component-database.ts显示你的组件声明 -
我有默认的 AppComponent 并复制它以使用不同的 app.component.html (需要服装)并在 angular.json 中替换它......但我没有声明,因为有一个替代品另一个
-
如果只是 html 更改,请尝试保留相同的组件并仅替换
angular.json中的 html。 -
非常感谢,我这样做了,因为在这种情况下实际上不使用 .ts 文件,但有其他错误
ERROR in : Cannot determine the module for class BookappointmentsComponent in D:/desarrollos/PatientPortal/front/src/app/customizations/database/bookappointments.page-database.ts! Add BookappointmentsComponent to the NgModule to fix it.在这种情况下我使用这个 .ts 文件 -
这里的问题是
BookappointmentsComponent在任何NgModule中都没有被引用。见:stackoverflow.com/questions/47119135/…
标签: angular aot angular-aot