-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default export of apexcharts.esm.js is SVG.js, not ApexCharts #1760
Comments
That's very interesting. I was wondering why all of the code-sandboxes stopped working without any reason recently. |
@junedchhipa Can you clarify your previous comment. Are you saying that ApexCharts doesn't support bundlers such as webpack atm? Because that seems to be my understanding based on this issue and another issue I've raised: #2315 |
Hi foks. Nice project. I'm just curious. Is this still a problem, or just forgotten to be closed? |
I'm not totally clued up here, but looking at the source code for the latest version of the library, i'm not seeing the module code at the start: https://cdnjs.cloudflare.com/ajax/libs/svg.js/3.2.0/svg.js vs the one that's included in this repo: https://cdnjs.cloudflare.com/ajax/libs/svg.js/2.6.6/svg.js However, there are breaking changes between v2 and v3 which are documented in the changelog: https://github.com/svgdotjs/svg.js/blob/master/CHANGELOG.md So it would take a bit of work to update it in this project, and then test reverting the change that disabled the ESM module to fix apexcharts/ng-apexcharts#92 |
Bug report
Codepen
I think most of the examples that use webpack are broken, but I was looking specifically at this one: https://codesandbox.io/s/o7339qql3z
Explanation
This results in
TypeError: this.chart.render is not a function
If you debug
vue-apexcharts
you'll see it breaks on this codeand if you step into
ApexCharts
you'll see you end up in the SVG constructor function here: https://github.com/apexcharts/apexcharts.js/blob/master/src/svgjs/svg.js#L24rather than in the ApexCharts class constructor.
If I had to guess I'd say the UMD wrapper around SVGJS is confusing the module output from rollup and switching the default export. I think the latest versions of webpack uses the package.json#module field to determine the bundle, so I think this bug breaks builds using apexcharts inside a webpack build (I used parcel to test, which is also broken) while projects that use the other bundles seem unaffected.
I think this is related to the same issue here:
apexcharts/vue-apexcharts#64
The text was updated successfully, but these errors were encountered: