As a follow up to the post above:
Having put significant time into making js-joda amenable to Dead Code Elimination, I have decided to shelve the effort for now. The reasons for this are:
- My experiments show Google Closure does not fully eliminate unused js-joda code in many cases. I guess it can’t analyze the code well enough and has to play safe. If the cljs app doesn’t use js-joda at all, then none of js-joda is included, but that’s not the extent of DCE I was hoping for.
- The js-joda add-on libs (timezone and locale) would need to be completely reworked to be DCE friendly - and I’m not 100% sure that’s possible. If that couldn’t happen, end users would probably have to juggle
:exclusions
to choose npm or non-npm js-joda - not great. - Temporal is getting closer to reality - maybe shipped in some browsers in 2021? see https://github.com/tc39/proposal-temporal/issues/1079.
Further reading:
- js-joda PR: https://github.com/js-joda/js-joda/pull/463
- comparison of Temporal to java.time: http://widdindustries.com/ecma-temporal-vs-java-time/
Thanks again to Clojurists Together for funding some of this effort.