From 4c7e5d47cb1ab6f289645f51411654618d07db90 Mon Sep 17 00:00:00 2001 From: Iskren Chernev Date: Wed, 11 Oct 2017 01:24:39 +0300 Subject: [PATCH] Revert "Rename dynamic require to avoid React Native crash" This reverts commit 6a230ae3b574417945b9d7bf459e296eb2585935. --- src/lib/locale/locales.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/lib/locale/locales.js b/src/lib/locale/locales.js index d8bb937c9..7df7ae3c4 100644 --- a/src/lib/locale/locales.js +++ b/src/lib/locale/locales.js @@ -46,22 +46,19 @@ function chooseLocale(names) { } function loadLocale(name) { - var oldLocale = null, - // workaround for React Native 0.49+ - pretendingNotToRequire = require; - + var oldLocale = null; // 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 { - pretendingNotToRequire('moment/locale/' + name); + 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 { - pretendingNotToRequire('./locale/' + name); + require('./locale/' + name); } catch (e) { } } -- 2.47.2