concurrently imports the entire date-fns library without tree-shaking but use only 1 function
See original GitHub issueI have found this issue while investigating why my project still had the entire date-fns library bundled even if I was carefully importing and using only a few functions.
date-fns provides a syntax that will allow bundlers like Webpack to do some “tree-shaking” and only import the needed modules rather than the full library, optimizing greatly the total bundle size.
It seems like concurrently doesn’t use this syntax, which causes to import the full date-fns library instead of only the single function used in logging (formatDate
in logger.ts and log-timings.ts).
How found this :
I had opened an issue about this originally on the date-fns repo because I thought it came from there.
After some discussions around the issue, someone mentioned here that it could come from another dependency importing all of date-fns by not using tree-shaking syntax. The recommendation was to use npm why date-fns
to spot which other dependency may use date-fns.
When running that command, it only listed my own references to date-fns (using the syntax allowing tree-shaking) and the concurrently
library.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Hi, yes that’s fair enough… I did not have any free time to work on a minimal reproduction of this issue. Thank you
Closing this as I don’t see any room for improvement here on our side. Please open a new issue with a reproduction if this is still a problem.