[DISCUSSION] Referencing chart.js through our library
See original GitHub issueIn the README and in our samples, we reference chart.js and moment.js through our library with the _content
directory added by blazor. It’s included in the sources of this library and is automatically integrated into the client-side root of applications that consume this library.
But why?
We can write what version of chart.js we currently support and we can let the consumer chose themselfs how to include the chart.js. We can also let them chose if they want the minified version or not. Why should we include the JavaScript-file of chart.js in our library as well, doesn’t it just bloat the nuget size?
It would be a breaking change to remove it but here’s why I think it would make sense.
Pro
- Smaller nuget-size
- We can keep the type files for TypeScript, no need to change that
- When we migrate to chart.js 3.0, we’ll have trouble with the time-adapters anyway. You don’t need moment.js anymore, you can use any time-adapter you want. So which one would we have in our library?
- More flexible for the consumer (minified, version, cdn)
- Only the script tag in the
_Host.cshtml
orindex.html
would change in the consumers application
Contra
- Breaking change, consumers need to change some code
- We need to clearly document what version we support and be aware of it (this is actually a benefit IMO but it requires additional work)
If possible, I would like to hear some opinions on this before we decide anything. Can anyone tell us some good arguments for keeping it in? Or do you agree with me that it should be excluded from the project and just be documented well?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Closing this because I recently removed the pre-built Chart.js code and also all moment.js stuff. When I release 2.0, I’ll update the readme to use a CDN link with a notice that you can download the latest builds from the Chart.js page if you don’t want to use a CDN. I think that’s a good way to handle it.
@Joelius300 Yeah, this seems like a good idea.