-
Notifications
You must be signed in to change notification settings - Fork 837
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
Specific Locales using Webpack #364
Comments
@arb i had used webpack
this helped me to achieve 30% reduction in my client bundle size(gzip) and 70% reduction in moments js bundle size(429.12kB => 125.92kB) also 92% reduction in moment-timezone bundle size(190.11kB => 13.61kB) |
@VeeteshJain Could you give an example of your momentTz.json? - whenever I edit the packed version it breaks |
@evanjmg @VeeteshJain Could you give an example of your momentTz.json? - whenever I edit the packed version it breaks too |
Here's a full account of the changes I needed to get this working:
|
I think it would be interesting if moment timezone let us feed the json at runtime, that would allow us to filter it and fetch using ajax. |
You can use the separate For loading data at runtime, that's also possible. You can load a different entry point to get import moment from 'moment-timezone/moment-timezone';
// Load your custom data elsewhere, then...
moment.tz.load(customData); |
How can I limit the locales that are loaded from
'./data/packed/latest.json'
? I already read and implemented the suggestions in #356 but that only impacts "moment" when it loads up it's internal locals; not this latest file moment-timezone loads on line 2.Ideally, we would load that "latest.json" file, parse it, and
delete
the locales off of it my app does not need at build time.The text was updated successfully, but these errors were encountered: