I have an angular app using moment.js and chart.js modules.
After replacing moment.js with date-fns I noticed that the size of the vendor.js file increased while it should've been decreased. After visualizing the content of it and searching for any dependencies on moment.js I saw a few things:
- moment.js wasn't deleted from
node_modules
but only from package.json after usingnpm prun
andnpm uninstall moment --save
and more.. - The vendor.js file contains both the date-fns and moment.js modules.
- package-lock.json list moment.js as a dependency of my project and it's a dependency of chart.js too.
First of all, I'd like to confirm that the reason the moment.js appears in all of the above is that it's chart.js's dependency.
Secondly, how can I truly remove moment.js and get the vendor.js to be lighter?
Thanks a lot!
Indeed, moment.js is a chart.js's dependency. Here are a few options to avoid importing moment
Your size bundle increased because now you have moment and date-fns