Ng2-charts: Not Compatible with Angular 9 Ivy

Created on 13 Jul 2020  Â·  9Comments  Â·  Source: valor-software/ng2-charts

After adding the ChartsModule to app.module.ts and executing ng serve you get error as:

ERROR in node_modules/ng2-charts/lib/charts.module.d.ts:1:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (ng2-charts) which declares ChartsModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also, consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

1 export declare class ChartsModule {

Screenshot (56)

Please refer the screenshot for clearity

Most helpful comment

It is due to some of the dependencies of ng2-charts (including Chart.js) using non ES imports. It will be hopefully addressed when Chart.js is updated to 3.0.0, worst case scenario now is that your bundle size is slightly bigger.

All 9 comments

I've Installed the Latest one available to the current date.

I don't know why but when I do ng build --prod I don't see any errors

@bornagainraj7 I've encountered that error also. I just restart the server then the error is gone

Please check now, @santam85 has authored a major change updating the library for Angular 10.

@paviad I've just updated to Angular 10 and ng2-charts v2.4.0 and I've run into the following issue:

WARNING in C:\Users\...\node_modules\ng2-charts\__ivy_ngcc__\fesm2015\ng2-charts.js depends on 'chart.js'. 
CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Should I post this as a new issue? Just seemed related to your comment.

I believe that is a new issue. Angular 10 projects issue that warning on many libraries. I am not proficient enough to understand what this warning is really about.

It is due to some of the dependencies of ng2-charts (including Chart.js) using non ES imports. It will be hopefully addressed when Chart.js is updated to 3.0.0, worst case scenario now is that your bundle size is slightly bigger.

I don't think it has any actual effect apart from letting you know about
the optimization and bundle size.

On Thu, Aug 27, 2020 at 11:57 AM Marco Santarelli notifications@github.com
wrote:

It is due to some of the dependencies of ng2-charts (including Chart.js)
using non ES imports. It will be hopefully addressed when Chart.js is
updated to 3.0.0, worst case scenario now is that your bundle size is
slightly bigger.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/valor-software/ng2-charts/issues/1239#issuecomment-681819334,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAJNV2DOBYKCAXF2E5RAFJDSCYNYDANCNFSM4OYQK52A
.

After adding the ChartsModule to app.module.ts and executing ng serve you get error as:

ERROR in node_modules/ng2-charts/lib/charts.module.d.ts:1:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (ng2-charts) which declares ChartsModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also, consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

1 export declare class ChartsModule {

Screenshot (56)

Please refer the screenshot for clearity

@bornagainraj7 did you find any solution for this ng-chart2 issue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

egervari picture egervari  Â·  4Comments

martinpinto picture martinpinto  Â·  3Comments

dj-techs picture dj-techs  Â·  3Comments

brandonreid picture brandonreid  Â·  3Comments

RKornu picture RKornu  Â·  3Comments