score:1
as jop explained, chart.js depends on moment.js package that has 250k with locales.
if you don't have dates in your chart data you can remove moment package completely from result bundle without replacing it with another package. moment package just could be marked as an external dependency in webpack.
i.e. something like this, depending on you webpack configuration.
module.exports = {
...
externals: {
moment: 'moment',
},
}
score:8
turns out the issue is chart.js in npm depends on moment.js, which inludes about 250k of locales. the fix is to ignore these locale files:
var webpack = require("webpack");
module.exports = {
// ...
plugins: [
new webpack.contextreplacementplugin(/moment[\/\\]locale$/, /de|fr|hu/)
// new webpack.ignoreplugin(/^\.\/locale$/, /moment$/)
]
};
more info here:
Source: stackoverflow.com
Related Query
- npm chart.js is big after minimization
- VueJS + Chartjs - Chart only renders after code change
- Chart js - Get bar width after render
- Callback after line chart rendered
- ChartJs Bubble chart - on hover bubble becomes too big
- Chart disappears just after finishing animation
- chart js with angular2 loading dynamic data only after zoomin
- Charts js and laravel: Render chart after passing in json data
- Code doesn't work after updating chart.js versioning
- ChartJS chart not scaling after adding values
- Problems hovering over ChartJS bar chart after being redrawn
- Chart.js - Pie chart calculate sum of visible values after legend click
- Strange "padding" at chart area after updating chart.js (2.8.0 -> 3.4.1)
- ChartJS 2 - Adding data to chart breaks after X number of items added
- Chartjs bar order adjustment after bar chart is drawn
- Why chart renders after second click - react-chartjs-2
- ChartJs Memory Leak | Garbage Collection does not clean Chart Object or Arrays after render
- Resetting transform: rotate() by removing and appending canvas not showing data after appending and redrawing chart
- Chart.js animate chart after clicking a button
- what is wrong with my code ? java script chart position
- How to print a chart rendered by code
- ChartJS chart is bugged after adding new data
- chartJS pie chart not updating after axios GET
- Update chart axis labels after hover - chart.js
- How to show symbols after the label and before the numeric value using chart.js Bar chart in Angular
- (Chart.js) Is there a way to compare one chart with another so as not to have this inconsistent effect of small values being as big as big values?
- Chart JS: All Values Displayed on x-axis After Callback Conversion
- How can I change the background colors of a bar chart after it has been created?
- How do I destroy/update Chart Data in this chart.js code example?
- Chart.js scatter chart stops working after extending to multiple datasets
More Query from same tag
- ChartJS and jsPDF - why the background is black?
- Annotation problem with ng2-charts in Angular 11
- How to create a Doughnut chart in django admin interface using foreign key field data?
- I'm unsure of how to get vue js and charts js to work together. correctly
- Charts not rendering properly in Angular
- Chart js nested pie label colors in legend
- Using Chart.js on Laravel 5.3
- ChartJS: Mapping Non numeric Y and X
- ChartJS line chart x = y not rendering astraight line
- How to put implement chart.js into an existing page django
- Change horizontal line chart to vertical line
- Updating chart.js chart with dataset of different size
- Chartjs, plot data based with unequal time intervals
- Adding color dynamically to Chart.js
- Chartjs: Need help on drawing a vertical line when hovering cursor
- How do I populate chart.js labels with array items?
- Dynamically creating graphs with jQuery
- Mixed chart barchart won't show
- How to execute a JavaScript function with ChartJS and FreeMarker?
- chartjs how to change decimal to integers X-axis
- Saving chart.js chart to a folder (Not download)
- Dynamic multiple charts in chart.js with dynamic data inside them
- How to make labels clickable in angular-chart
- Is it possible to merge duplicate labels (and their datas) into one column in Chart Js?
- How to make chart with chartjs.?
- How to add font family to Chart.js V3.7.0
- Pie Chart: load image in segment and click
- How to use chart.js in Angular2?
- How to create a charjs bar graph with many bars?
- How to subscribe to elements in a response object