Arokia Lijas
Arokia Lijas

Reputation: 543

typeError: Cannot destructure property 'init' of 'object null' as it is null in ngx e-charts

I got this when I was using ngx-echarts. When using versions 4.x.x everything worked fine. After an npm i the application failed to run.

Upvotes: 0

Views: 1165

Answers (2)

BSmile
BSmile

Reputation: 56

The solution proposed by @Arokia Lijas didn't work for me It generated errors in build --prod

so I found this one :

export function chartModule(): any {
      return import('echarts');
        }

and in NgModule:

    NgxEchartsModule.forRoot({
  echarts: chartModule
}),

It did work perfectly for me. Source: https://github.com/xieziyu/ngx-echarts/issues/241#issuecomment-742777787

Upvotes: 1

Arokia Lijas
Arokia Lijas

Reputation: 543

The problem was because of a version update in ngxe-charts. If using versions >5.0 use this in app.module

    NgxEchartsModule.forRoot({
       echarts: { init: echarts.init }
  })

In tsconfig.json in angular compiler options add this too

"enableIvy": false

Upvotes: 3

Related Questions