Chart.js: Error: Module name "core/core.js" has not been loaded yet for context
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<script src="require.js"></script>
</head>
<body>
<canvas id="myChart" width="400" height="400"></canvas>
<script>
var ctx = document.getElementById("myChart");
require(['Chart.js/src/chart.js'], function(Chart){
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(255, 159, 64, 0.2)'
],
borderColor: [
'rgba(255,99,132,1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
],
borderWidth: 1
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero:true
}
}]
}
}
});
})
</script>
</body>
</html>
Error: Module name “core/core.js” has not been loaded yet for context: _. Use require([]) http://requirejs.org/docs/errors.html#notloaded
…=c[b]});return c}function F(b,c,d,g){c=Error(c+"\nhttp://requirejs.org/docs/erro…
require.js (Zeile 7, Spalte 290) TypeError: Chart is not a constructor
var myChart = new Chart(ctx, {
index.html (Zeile 16, Spalte 15)
So … without require.js I get an error and with require.js I get an error … Now what?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 25 (10 by maintainers)
We have restructured the repository so that there is no longer a dist folder. Please access Chart.js builds with a CDN or by downloading from the releases page.
Closing because an acceptable answer has been provided and the problem appears to be solved.
@MaxBondarchuk can you elaborate and/or share a test case of the issue which is still not fixed? we brought back dist files in tags and releases since 2.3.0, Sept. 2016, so loading
dist/Chart.min.jswith RequireJS is supposed to work without the need to build anything on your side.Really … It does not run on my web server … so, nothing solved as of now.