问题描述
当我使用编译我的应用程序时
When I compile my app with
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
可以正常编译,我的应用也可以正常运行.
It's compile ok and my app works ok.
我看到的区别是第一个是使用AOT选项进行编译的,但是我不知道为什么会出现此错误,也不知道它是否很重要(也许是关于我拥有的扩展类,但是对我很重要).你能帮我吗?
I see the difference is the first one is compile with the AOT option, but I don't know why have this error, and don't know if it is important (maybe is about an extended class I have, but is important to me). Can you help me?
推荐答案
当您声明不属于任何模块的组件时,Angular通常会抱怨.
Angular normally complains when you declare a component that is not part of any module.
如果您只想在构建时修改默认的AppComponent
html模板,则可以创建一个单独的html模板,并使用angular.json
中的fileReplacements
功能.
If you just want to modify the default AppComponent
html template at build time, you can just create a separate html template and use fileReplacements
feature from angular.json
.
这篇关于Angular编译之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!