Closed soumyasankarduttagit closed 4 years ago
@soumyasdutta When you are implementing FusionCharts as ES modules, you should not import it as follows:
import * as FusionCharts from 'fusioncharts/core';
Please change
import * as FusionCharts from "fusioncharts/core";
import * as Column2d from "fusioncharts/viz/column2d";
import * as FusionTheme from "fusioncharts/themes/fusioncharts.theme.fusion";
to
import FusionCharts from "fusioncharts/core";
import Column2d from "fusioncharts/viz/column2d";
import FusionTheme from "fusioncharts/themes/fusioncharts.theme.fusion";
In ES modules, import *
returns a module object which contains all the parameters that are exported within that module(both named and default export).
Consider,
const array = [1, 2, 3];
class Random {}
export { array }; // named export
export default Random; // default export
If we import it as *
, then we will get an object of roughly the following structure
{
array: [],
default: class Random
}
So, a module which is expecting the Random
class will receive an object containing a default
property set to Random
class. Hence, the error.
angular-fusioncharts is throwing an error while implementing FusionCharts as ES6 module
Sample replicating the issue https://www.dropbox.com/s/2og83hv947cw6rw/IssueFusionCharts.zip?dl=0 Please check the following error log![image](https://user-images.githubusercontent.com/20278039/70432938-61725e80-1aa6-11ea-87f5-5928a6ff4be6.png)