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
Add way to remove moment from build #1108
Comments
@paviad check this |
I am not proficient in webpack, moment is indeed a part of chart.js therefore I have no easy way to get rid of it in ng2-charts... |
You can import standalone version - not bundled one with the following line:
Or setting alias
|
But I do not include chart.js as a dependency but as a peer dependency - so it is up to the user to include all of chart.js or just the bare package without the bundle. |
you should change the chart.js import at
this should solve the problem |
Any update on this? This can save 574.32 Kb. With chart.js 2.8 it should now be possible. I would also like to know if we can also remove lodash.js dependency? |
I'm also interested about any update. I'm in the same situation with naveedahmed1. |
Hello, Any updates on this? |
Copy the base directive in your project and apply the following update |
That would require me to copy the code from github. I'm using the npm package |
Wait, what is wrong with this import in import {
Chart,
ChartConfiguration,
ChartDataSets,
ChartOptions,
ChartPoint, ChartType,
PluginServiceGlobalRegistration,
PluginServiceRegistrationOptions,
pluginService
} from 'chart.js'; |
You can use a custom webpack configuration to mark
|
fixed in v3+ |
Moment js increase the bundle size, add option to remove it while build
Moment.js is installed along Chart.js as dependency. If you don't want to use Moment.js (either because you use a different date adapter or simply because don't need time functionalities), you will have to configure your bundler to exclude this dependency (e.g. using externals for Webpack or external for Rollup).
https://github.com/chartjs/Chart.js/blob/f2b099b835bf5d6dfe3a7d3097997ec11983c3ed/docs/getting-started/integration.md#L28
The text was updated successfully, but these errors were encountered: