角度编译之间的差异



当我编译我的应用程序时

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

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

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

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

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

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

最新更新