Chartjs-How to use require(chart.js) in codesandbox

1👍

To load and register everything, try:

import Chart from 'chart.js/auto';

…which is short for…

import { Chart, registerables } from 'chart.js';
Chart.register(...registerables);

…which in turn is short for importing and registering every part individually. See the documentation for more examples.

-1👍

Chart class is exported as a named export.

Use: import {Chart} from 'chart.js'

Leave a comment