Skip to content
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

Bundle size increased a lot between 2.0.1 and 2.0.2 #75

Closed
sebastianljunggren opened this issue Jun 25, 2019 · 2 comments
Closed

Bundle size increased a lot between 2.0.1 and 2.0.2 #75

sebastianljunggren opened this issue Jun 25, 2019 · 2 comments

Comments

@sebastianljunggren
Copy link

sebastianljunggren commented Jun 25, 2019

When upgrading to 2.0.2 in my Angular project I noticed that my bundle size increased quite a bit.

According to https://bundlephobia.com/result?p=js-joda-timezone@2.0.2 the the size went from 183 to 910 kB (without gzip) which seems like a lot for what only seems to be an upgrade of the time zone database.

I'm creating this issue since I'm not aware if this increase is intended or if some step in the upgrade of the database was missed.

@pithu pithu added the bug label Jun 25, 2019
@pithu
Copy link
Member

pithu commented Jun 26, 2019

The issue is caused by a fix in moment-timezone see https://github.com/moment/moment-timezone/blob/c377ac8fd7ff6c2fc52e2f432034ac5727dba1d8/changelog.md#0522-2018-10-28. Since that release, the packed tzdb data file got much bigger, see https://bundlephobia.com/result?p=moment-timezone@0.5.25

js-joda-timezone is using the packed version from moment-timezone, so we get the same effect here. I am not 100 percent sure, but i guess the bigger size is just because of more accurate data, so nothing what could be fixed.

Fortunately (thx to @jkillian #73), since the latest release (version 2.1.0) we build smaller javascript bundles, that contain only a subset of the tzdb data for a certain range of years. Currently we support the same ranges as moment-time-zone:

bundle size
all 911 KB
10-year-range 34 KB
1970 - 2030 150 KB
2012 - 2022 34 KB

So if its an option for you, you could use one of the subsets. see https://github.com/js-joda/js-joda-timezone#reducing-js-joda-timezone-file-size

@pithu pithu closed this as completed Jun 26, 2019
@sebastianljunggren
Copy link
Author

Thank you for the quick reply and new release! One of the smaller bundles are fine for my use case.

@pithu pithu removed the bug label Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants