valor-software/ng2-charts

Module '"ng2-charts"' has no exported member in v6

elementalTIMING opened this issue · 1 comments

After updating to v6.0.0 it's no longer possible to compile:

Module '"ng2-charts"' has no exported member 'NgChartsModule'.

import { NgChartsModule } from 'ng2-charts';

How to fix? I already tried to remove npm cache and run a complete new npm install

That was intentional and was mentioned as a breaking change in the changelog for v6.0.0. You need to import the library in standalone mode, per #1801.

i.e.

import { provideCharts, withDefaultRegisterables } from 'ng2-charts';

@NgModule({
  providers: [provideCharts(withDefaultRegisterables())],
  bootstrap: [AppComponent],
})
export class AppModule {}