Chartjs-Chart.js 2.9.4 – error using bundle from CDN – "chart is not defined"

0πŸ‘

βœ…

Can’t believe I struggled with it, but the key is from where I import the lib, in the case "chart.js" and the value is what I import, in the case Chart, not "chart.js".

Correct should be:

  externals: {
    react: 'React',
    axios: 'axios',
    moment: 'moment',
    'react-dom': 'ReactDOM',
    'react-router-dom': 'ReactRouterDOM',
    'chart.js': 'Chart'
  }

Leave a comment