Angular 2 - AOT - 调用函数 'ChartModule',不支持函数调用

Angular 2 - AOT - Calling function 'ChartModule', function calls not supported

我为此失去了理智和头发。我在 Angular 2 中导入 HighCharts,但需要它的一些额外库。到目前为止,在我的代码中我有

import {ChartModule} from 'angular2-highcharts';
@NgModule({
....
imports:[
ChartModule.forRoot(require('highcharts'), require('highcharts/modules/drilldown'))})
]

但是我一直收到这个错误

ERROR in Error encountered resolving symbol values statically. Calling function 'ChartModule'. function calls are not supported. Consider replacing the function or lambda with a reference to an exported fucntion.

所以我尝试了

export function highchartsRequire:any {
   return{
     require('highcharts'), 
     require('highcharts/modules/drilldown')
   }
}
...
ChartModule.forRoot(highchartsRequire())

还是不行。有什么想法吗?

使用 angular 2 angular cli: 1.0.0-beta.30

更新 - 由于 JayChase

使其部分工作

这个有效

export function highchartsFactory() {
      return require('highcharts');

    }

但是我不能一次要求两个

declare var require: any;
export function highchartsFactory() {
  return function () {
    require('highcharts');
    require('highcharts/modules/drilldown')
  };
}

@NgModule({
  imports: [
    ChartModule
  ],
  providers: [
    {
      provide: HighchartsStatic,
      useFactory: highchartsFactory
    }
  ],

有什么想法吗?谢谢。

有一个未解决的问题和一个使用导出函数的解决方法 here

    import { BrowserModule } from '@angular/platform-browser';
    import { NgModule } from '@angular/core';
    import { FormsModule } from '@angular/forms';
    import { HttpModule } from '@angular/http';
    import { ChartModule } from 'angular2-highcharts';
    import { HighchartsStatic } from 'angular2-highcharts/dist/HighchartsService';

    import { AppComponent } from './app.component';

    declare var require: any;

    export function highchartsFactory() {
      const hc = require('highcharts');
      const dd = require('highcharts/modules/drilldown');
      dd(hc);

      return hc;
    }

    @NgModule({
      declarations: [
        AppComponent
      ],
      imports: [
        BrowserModule,
        FormsModule,
        HttpModule,
        ChartModule
      ],
      providers: [
        {
          provide: HighchartsStatic,
          useFactory: highchartsFactory
        }
      ],
      bootstrap: [AppComponent]
    })
    export class AppModule { }