[i18n - react-intl] importing only locales you need

My app uses react-intl, which depends on intl-messageFormat and intl-relativeFormat.

Both react-intl and intl-relativeFormat are huge in size, increasing my bundle by about 350kB. Has anyone successfully imported only the locales that they need, instead of all the languages all the time?

Right now I think my best chance is to fork and modify the packages, but I’d love to avoid that.

1 Like

I’m having exactly the same issue, the bundle size is insane in context with meteor. How do other devs solve this when they need to use meteor + react + intl?

1 Like

I ended up forking the intl-relativeFormat and modifying it so that it only uses the locales that I use.

Feel free to do the same: https://github.com/Floriferous/intl-relativeformat

thanks a lot @florianbienefelt

I also think that https://github.com/meteor/meteor-feature-requests/issues/5 might help here, but so far I’m not hoping for a quick implementation as this request seems to be stuck.

I’ve created an issue on this https://github.com/meteor/meteor/issues/9097

I’m also using react-intl. Due to the locales my bundle size is increased by atleast 600kb, although I only require a few locales. Is there any proper solution to use only some selected locales or to load them async, when required?

Any suggestions? 334kb (react-intl) + 325kb (intl-relativeformat) are due to locale. That’s 30% of my bundle size.

Same issue here, possible the bellow issue might help us. It has been scheduled for 1.6.1 at the moment. Fingers crossed. Any other solutions that anyone knows of?