首页 > 解决方案 > Angular 6 AOT 编译错误:装饰器中不支持函数调用

问题描述

我在我的 Angular 项目上ng-intercom从(https://www.npmjs.com/package/ng-intercom)安装,实现了这一点。它的工作,但在ng serve模式。但是当我执行命令ng build --prodng build --aot. 我得到错误:

ERROR in Error during template compile of 'AppModule'
Function calls are not supported in decorators but 'IntercomModule' was called.

我执行时它工作正常ng build

这是我的AppModule

import { IntercomModule } from 'ng-intercom';

@NgModule({
  declarations: [MyComponent],
  imports: [

    BrowserModule,
    BrowserAnimationsModule,
    HttpClientModule,

    IntercomModule.forRoot({
      appId: 'my_id',
      updateOnRouterChange: true,
    }),
  ],
  providers: [],
  bootstrap: [MyComponent],
})
export class AppModule {}

标签: angulartypescript

解决方案


这在版本中已修复7.0.0-beta.1。快乐编码:)


推荐阅读