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
Reduce prebuilt locale package sizes #421
Comments
Hi @jkillian , thanks for using js-joda and reporting the issue. The problem is that for the js-joda-locale package we need to implement parsing and formatting not only for month abbreviations but for all available patterns. We depend on data from cldr that provide some packaging of available localisation strings. There are strings in these packages that we do not need but the packages are as they are. So i'm afraid at the moment i don't know how to help you reduce the bundle size ... we could think about providing something like "core" packages that only contain some localisation functionality in the future but that is not on the roadmap currently :/ I'll close the issue because of this, feel free to reopen/ comment if you feel there is some way to address this. Regards, Pattrick |
Thanks for the response @phueper! Just a couple notes below I wrote up when I was looking at things: I was first curious about is how much of each locale is actual logic related to parsing and how much is data. When looking at As a (somewhat unfair comparison, but a comparison nonetheless), the data for a moment locale appears to be about 4KB. In the js-joda locale, it looks like the biggest consumers of space are:
@phueper I'm curious how this data overlaps with Another question I have is what the use of And then these are the remaining data files:
Any thoughts on the above comments? I'm mostly just trying to get a grasp here of what it causing the size bloat and on what data is truly necessary vs. what is extraneous. It seems like time timezone data here is what's the biggest offender. |
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
I was really excited when I discovered js-joda. However, bundle size is the reason I will not use js-joda in a Web application. For anyone curious here is the generated en-us local package. Examining that file, it looks to me like most of that information is unnecessary. According to bundlephobia this is 43kB gzip, making your total investment in js-joda close to 100kB gzip if you only use the en-us locale. I also think calling the core package lightweight at 43kB gzip is misleading. I would not consider that lightweight for a dependency of a Web application. I do think 43kB is competitive for a date library if that included localization. For comparison Luxon is just over 20kB gzip and uses existing browser APIs for localization. I'm not saying Luxon is better than js-joda, quite the contrary, but when it comes to putting things on the internet size still matters. |
This is major a pain point for our team as well. @pithu are there any plans to address this in the near future? It looks like the main milestones on the public roadmap have been reached since the original issue was opened. |
Very likely its a new issue caused by moment/moment-timezone#999 Feel free to open a new issue, but unfortunately i have limited capacity to work on it |
Wanted to port over the issue I filed at js-joda/js-joda-locale#124 to the monorepo because I think it's still relevant! The file size of the locale packages is still quite large, and in the web apps I'm building js-joda is the largest contributor to bundle size, a large part because of the locale package sizes.
(Sorry if it was annoying of me to just copy over the issue! If so, feel free to close this one, but I'd love to continue discussion at least!)
Original comment:
The text was updated successfully, but these errors were encountered: