]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Revert "Rename dynamic require to avoid React Native crash" 4225/head
authorIskren Chernev <iskren.chernev@gmail.com>
Tue, 10 Oct 2017 22:24:39 +0000 (01:24 +0300)
committerIskren Chernev <iskren.chernev@gmail.com>
Tue, 10 Oct 2017 22:24:39 +0000 (01:24 +0300)
This reverts commit 6a230ae3b574417945b9d7bf459e296eb2585935.

src/lib/locale/locales.js

index d8bb937c95516a773ec8e7a119a0041aba801cc3..7df7ae3c40266e5e783217759efabafafd2e5cf5 100644 (file)
@@ -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) { }
         }