Angular编译之间的差异

时间:2020-06-26 08:26:02

标签: angular aot angular-aot

当我使用编译应用程序时

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选项进行编译的,但是我不知道为什么会出现此错误,也不知道它是否很重要(也许是关于我拥有的扩展类,但是对我很重要)。你能帮我吗?

2 个答案:

答案 0 :(得分:1)

当您声明不属于任何模块的组件时,Angular通常会抱怨。

如果您只想在构建时修改默认的AppComponent html模板,则可以创建一个单独的html模板,并使用fileReplacements中的angular.json功能。

答案 1 :(得分:0)

我在github存储库中找到了帮助:

https://github.com/angular/angular/issues/38070

就我而言,我正在尝试使用@Component装饰器(insteed @Directive装饰器)来编译和抽象类。

相关问题