Create chunks with intl langs data only for en/ru locales

This commit is contained in:
SleepWalker 2016-05-22 13:24:28 +03:00
parent d45b3da5d6
commit 4404968df2

View File

@ -31,14 +31,18 @@ export default {
require(locale) {
const promises = [
new Promise(require(`bundle!i18n/${locale}.json`))
new Promise(require(`bundle?name=[name]!i18n/${locale}.json`))
];
if (needPolyfill) {
promises.push(new Promise((resolve) => {
require.ensure([], () => {
require('intl');
require(`bundle!intl/locale-data/jsonp/${locale}.js`)(resolve);
require.context(
'bundle?name=[name]-polyfill-data!intl/locale-data/jsonp',
false,
/\.\/(en|ru)\.js$/
)(`./${locale}.js`)(resolve);
});
}));
}