Join GitHub today
#4454 Dynamically import Moment locales to reduce client bundle size #4455
When I ran Meteor's bundle visualizer with RC, I noticed that MomentJS (257kb) was included in the initial client bundle, even though some work had previously been done to have it dynamically imported via a Reaction High Order Component. The most significant file was Moment's locales (204kb).
There was 1 import in /client/modules/core/helpers/templates.js that was loading moment's locales. Moving that line to a dynamic import in
It is important to note that
Note: moment.js still appears in the client bundle, but at a much smaller size (54kb).
changed the title
#4454 Dynamically import Moment locales to reduce client bundle size
Jul 19, 2018
Thanks @zenweasel - I updated the PR, description, and testing instructions. I figure this issue & PR can just be for dynamically importing Moment's locales (unless you think otherwise). The rest of core all appears to be importing moment dynamically, yet moment.js (54kb) is still in the bundle as you noted. This is worth more research, as something (maybe a Meteor package) is loading moment.
@dancastellon When following the test instructions (steps 3 & 4) I get this error in the console. It appears there's still a problem here: