Import Chart.js without moment
See original GitHub issueExpected Behavior
If I import chart.js over import Chart from 'chart.js'
it should grab the standalone version without moment.js and with import Chart from 'chart.js/dist/Chartjs.bundled.js'
it should grab the bundled one.
Current Behavior
import Chart from 'chart.js'
grabs the bundled version.
Possible Solution
Multiple entry points.
import Chart from 'chart.js' // grabs standalone
import Chart from 'chart.js/bundled' // grabs bundled
Issue Analytics
- State:
- Created 6 years ago
- Reactions:21
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Integration | Chart.js
Chart.js is tree-shakeable, so it is necessary to import and register the controllers, elements, scales and plugins you are going to use. # ......
Read more >Remove Moment.js as Dependency / Reduce Bundle Size ...
You can import standalone version - not bundled one with the following line: import Chart from 'chart.js/dist/Chart.js'.
Read more >chartjs-adapter-moment - npm Package Health Analysis - Snyk
This adapter allows the use of Moment.js with Chart.js. Moment.js is a very heavy library and thus not recommended for client-side development. However,...
Read more >Changing from moment to Day.js — how, why and fixing vue ...
If you simply import dayjs and Chart.js in your entry file and start messing with plugins and adapters, the code splitting system isn't ......
Read more >How to Use Different Date Formats in Chart.js - YouTube
jsIn this video we will explore how to user different date formats in Chart. js. Adding dates in Chart. js should be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
it’d be great to have chartJS move from moment to date-fns though. It would be quite the file size reduction.
Well you can import the standalone
import Chart from 'chart.js/dist/Chart.js'
Or you can set an alias in your webpack.config
Then it would pick the standalone if you
import Chart from 'chart.js'
However I think it should be the default behaviour to pick the standalone version without moment.