-
Notifications
You must be signed in to change notification settings - Fork 12k
Closed
Description
When using CommonJS with ES6 modules syntax (Babel, TypeScript...) there is limited support for import statements.
It is only possible to load a reference to the Chart object as a whole:
import * as Charts from 'chart.js';
This is also possible:
import {Controller, Element, Scale} from 'chart.js';
But it will not allow to get a reference to Charts itself.
In order to get this possible:
import {Chart, Controller, Element, Scale} from 'chart.js';
Chart should reference itself, so Chart.Chart === Chart
in core.js, something like this:
"use strict";
module.exports = function() {
//Occupy the global variable of Chart, and create a simple base class
var Chart = function(context, config) { /* ... */ }
Chart.Chart = Chart;
return Chart;
};
jmurphzyo