bigeasy / bigeasy/timezone

Removing unneeded timezones from bundle

Open
#292 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
256
Forks
26
PR merge metrics
No merged PRs in 30d

Description

Sorry if this is a trivial question/if this isn't the correct avenue, but is there any way to remove timezones and locales that are unused? My team and I only need to determine the time in the `America/New York` timezone, but it seems this library is pulling in packages related to every other available timezone/locale.

Here is how we're currently using the library:

```
import tz from 'timezone'

const getESTHours = (date) => {
const US = tz(require('timezone/America'))
const currentESTHour = US(date, 'America/New_York', '%H')
return parseInt(currentESTHour, 10)
}
```

And here's a screenshot of our bundle analysis, where the `timezone` module has contributed to a huge percentage of our bundle size.

![screen shot 2017-12-14 at 8 34 00 am](https://user-images.githubusercontent.com/6289711/34003448-177d97aa-e0aa-11e7-969d-4714afbefdb7.png)

We figured [Webpack's tree shaking](https://webpack.js.org/guides/tree-shaking/) feature with `UglifyJsPlugin` would have automatically removed them if they were unused, but we wanted to drop a note here just in case anyone else has run into this before.

Any help would be super appreciated! ✊

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the reported `timezone/America` import and compare the package contents with the Webpack bundle analysis shown in the issue. Determine whether unused timezones and locales can be excluded for this usage, and document a verified way to produce a smaller bundle or explain why it is not currently possible.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
performance, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.