[Chartjs]-Uncaught ReferenceError: Chart is not defined

1๐Ÿ‘

โœ…

If you look in app.js, is it wrapped in a function? It sounds like itโ€™s not part of the global namespace, despite being present in app.js.

2๐Ÿ‘

If youโ€™re using es6 you might need to change the way you require it.

from the docs:
http://www.chartjs.org/docs/

// Using CommonJS
var Chart = require('chart.js')
var myChart = new Chart({...})

// ES6
import Chart from 'chart.js'
let myChart = new Chart({...})

// Using requirejs
require(['path/to/Chartjs'], function(Chart){
var myChart = new Chart({...})
})

Leave a comment