-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Import Chart.js without moment #5235
Comments
Is there a way to use Chart.js without Moment? It is quite a large dependency |
Well you can import the standalone
Or you can set an alias in your webpack.config resolve: {
alias: {
'chart.js': 'chart.js/dist/Chart.js'
}
} Then it would pick the standalone if you However I think it should be the default behaviour to pick the standalone version without moment. |
Also, I don't think it needs all of momen.js. One can just import core moment with out locales and etc. See or if not try http://jmduke.com/posts/migrating-from-moment-to-date-fns/ |
Well that has nothing to do with the issue :D |
it'd be great to have chartJS move from moment to date-fns though. It would be quite the file size reduction. |
+1 |
@codeofsumit yea it would. But again, thats not what the issue is about. There is another issue about removing moment #4303 |
Closing as duplicate of #4303 which was fixed today |
We changed the Until 2.8, we used Browserify and the fact you was able to use However, the @apertureless 2.8 is not released yet and we would love to get feedback about these recent changes to get a chance to adjust our code in case we broke some use cases. Would you be able to test the current master against your vue-chartjs wrapper? Especially, the use case described in this ticket. |
Thats a bummer. Can we have moment as peer dependency somewhere in future? // webpack.js
// ...
resolve: {
alias: {
// avoids bundling moment twice in our bundle, since chart.js hat its own moment dependency
// https://github.com/chartjs/Chart.js/issues/5235#issuecomment-458854521
"moment": path.join(project.cwd, "node_modules", "moment", "moment.js")
}
}, besides that, this is a great library. |
Yes, moment will stop being a dependency in v3, but that may be quite some ways out. |
Expected Behavior
If I import chart.js over
import Chart from 'chart.js'
it should grab the standalone version without moment.js and withimport Chart from 'chart.js/dist/Chartjs.bundled.js'
it should grab the bundled one.Current Behavior
grabs the bundled version.
Possible Solution
Multiple entry points.
The text was updated successfully, but these errors were encountered: