-
Notifications
You must be signed in to change notification settings - Fork 5
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
Huge bundled size #5
Comments
If you upgrade, there might be a way :-) Still, the size of the package will be decided by the time zone data, which you want to include. Also beware, that there was a bug detected in The <script src="https://unpkg.com/[email protected]/dist/index-2012-2022.umd.js"></script>
<script arc="https://unpkg.com/dayjs-ext/dayjs.min.js"></script>
<script arc="https://unpkg.com/dayjs-ext/plugin/timeZone.js"></script> I'd like to try some techniques to let the outermost project decide, what year span should be supported and thus the full package size. An environment variable, module bundler (rollup, webpack) mapping for the For the time being, I created additional versions of the import dayjs from 'dayjs-ext'
import timeZonePlugin from 'dayjs-ext/plugin/timeZone-1900-2050'
dayjs.extend(timeZonePlugin) The size of the package is affected by the size of the time zone data included: Full IANA TZ data: 923 KB minified, 33.3 KB gzipped
Data for 1900-2050: 200 KB minified, 23.3 KB gzipped
Data for 2012-2022: 27 KB minified, 6.5 KB gzipped Alternatively, you could build your own time zone data for years 1970-2025, for example, and use the customizable version of the plugin - create-timezone-data -m -o data-1970-2025.js 1970 2025 import dayjs from 'dayjs-ext'
import timeZonePlugin from 'dayjs-ext/plugin/timeZone-custom'
import { populateTimeZones } from 'timezone-support/dist/lookup-convert'
import timeZoneData from './data-1970-2025'
populateTimeZones(timeZoneData)
dayjs.extend(timeZonePlugin) I still need to document the usage of the time zone data generator. Will some of these solutions work for you? |
Hi, I found a bundle size problem.
parsed size : 177kb, it is biggest library in my react application.
I am using dayjs-ext 2.0.2, timezone-support 1.5.5 for showing UTC timestamp to user local time.
Is there any way to reduce size? Thank you.
The text was updated successfully, but these errors were encountered: