[Chartjs]-Ng2-charts\ng2-charts.js does not export ChartsModule

3👍

The second issue in the comments

It is also showing an error that "Can’t bind to ‘datasets’ since it
isn’t a known property of ‘canvas’

is probably due to not importing ChartsModule into the module that is rendering the chart.

I had encountered the same initial issue and was able to get past it by adding the following to my rollup-config file

plugins: [
    nodeResolve({jsnext: true, module: true}),
    commonjs({
        include: ['node_modules/rxjs/**','node_modules/ng2-charts/**'],
        namedExports: {'node_modules/ng2-charts/ng2-charts.js': ['ChartsModule']} 
    }),
    uglify()
]

The documentation for this library could have been better.

I hope the post can help anyone encountering similar issues

Leave a comment