From a498bb8176af773a3cf41ce335a2cef44896ee59 Mon Sep 17 00:00:00 2001 From: Maggie Pint Date: Wed, 11 Oct 2017 07:53:49 -0700 Subject: [PATCH] revert locale fallbacks in require, re-add react native aliasing --- src/lib/locale/locales.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/lib/locale/locales.js b/src/lib/locale/locales.js index 7df7ae3c4..4efebb8ff 100644 --- a/src/lib/locale/locales.js +++ b/src/lib/locale/locales.js @@ -50,21 +50,12 @@ function loadLocale(name) { // TODO: Find a better way to register and load all the locales in Node if (!locales[name] && (typeof module !== 'undefined') && module && module.exports) { - oldLocale = globalLocale._abbr; try { - require('moment/locale/' + name); - } catch (e) { - // In the test environment, the external module 'moment' - // can't be resolved because we're running inside it. - // Fallback to using the old relative import - try { - require('./locale/' + name); - } catch (e) { } - } - - // because defineLocale currently also sets the global locale, we - // want to undo that for lazy loaded locales - getSetGlobalLocale(oldLocale); + oldLocale = globalLocale._abbr; + var aliasedRequire = require; + aliasedRequire('./locale/' + name); + getSetGlobalLocale(oldLocale); + } catch (e) {} } return locales[name]; } -- 2.47.2