const specialHandleLanguage = {
en: 'en-au',
pt: 'pt-br',
tl: 'tl-ph',
cn: 'zh-cn',
hk: 'zh-hk',
tw: 'zh-tw'
};
const lang = specialHandleLanguage['en'] || 'en';
require(`moment/locale/${lang}`);
moment.updateLocale(lang, {});
Due to momentJS
has different file name, so I have to "require" the file base on specific language. I'm wondering how to achieve it as I'm hitting below exception
error: bundling failed: Error: src/screen.js:Invalid call at line 449: require("moment/locale/" + lang)