Skip to content
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

Improve chart documentation #8718

Closed
steverob2k opened this issue Apr 6, 2020 · 2 comments
Closed

Improve chart documentation #8718

steverob2k opened this issue Apr 6, 2020 · 2 comments

Comments

@steverob2k
Copy link
Contributor

I'm submitting a ... (check one with "x")

[X] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Current behavior

Since the change to include Chart.js via an import instead of relying on global variable, there are 2 issues.

  1. If you follow the documentation and include chart.js via the scripts in angular.json, chart.js will get included twice in bundles. see the commit here

  2. The other side effect of this change is that moment.js will be included in webpack builds, whereas referencing as a global variable it does not get included into bundles.

Expected behavior

  1. The documentation should be changed to not state that chart.js needs to be included via scripts.

  2. not sure what the solution should be here. Either we have to wait until Chart.js 3.0, revert the above change or use ngx-build-plus to exclude moment?

What is the motivation / use case for changing the behavior?
The bundles are much bigger when using chart component because of the inclusion of moment.js and the double-entry of chart.js

  • Angular version: 8.X
    Angular version 8 and above

  • PrimeNG version: 8.X
    PrimeNG 8 and above

@cagataycivici cagataycivici changed the title Chart component bundle size Improve chart.js documentation Apr 6, 2020
@cagataycivici cagataycivici changed the title Improve chart.js documentation Improve chart documentation Apr 6, 2020
@steverob2k
Copy link
Contributor Author

steverob2k commented Apr 7, 2020

A solution for number 2, may not work for everyone but the project I work on I did not want moment at all. Since this is an optional dependency on chart.js I found this solution

For reference, add this to package.json. Seems webpack will exclude moment from the bundles

"browser": {
moment": false
}

Tested this with Angular CLI 8 and 9.

@cagataycivici
Copy link
Member

We'll do it as we're upgrading the charts.js now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants