-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Date: Optimize the usage of moment-timezone to save some kilobytes #12356
Conversation
@@ -38,9 +38,6 @@ | |||
"classnames": "^2.2.5", | |||
"lodash": "^4.17.10", | |||
"memize": "^1.0.5", | |||
"moment": "^2.22.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those dependencies are never used...
@atimmer, given that WordPress Core bundles |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@gziolo this is great, when are you releasing? |
It will be included in the upcoming Gutenberg plugin update this or next week (depending on how testing goes). It should be also included in WordPress core in a week or so. Not sure what is the timeline for that, to be honest. This year is safer to say :) |
Description
With the latest update of
moment-timezone
library there is a huge increase of the timezones data to be bundled by default. This is the consequence of the bug fix added in moment/moment-timezone#697. It turns out that JSON data is now at 925kB in0.5.23
version: https://unpkg.com/moment-timezone@0.5.23/data/packed/latest.json. This is a big change comparing to the version0.5.16
which we still bundle in Gutenberg: https://unpkg.com/moment-timezone@0.5.16/data/packed/latest.json - 126kB.This PR stops including JSON metadata for timezones because we use WordPress specific timezone in here:
https://github.com/WordPress/gutenberg/blob/master/packages/date/src/index.js#L94-L99
It turns out all that data is never consumed in the application and is useless. This opens some nice improvements for the size of the date bundle.
Before
After
How has this been tested?
npm test
Check whether scheduling posts still works as expected in Gutenberg.
Types of changes
Refactoring towards lower bundle size.
Checklist: