diff --git a/packages/metro-bundler/src/Resolver/polyfills/require.js b/packages/metro-bundler/src/Resolver/polyfills/require.js index f602596f..66ee06f8 100644 --- a/packages/metro-bundler/src/Resolver/polyfills/require.js +++ b/packages/metro-bundler/src/Resolver/polyfills/require.js @@ -234,6 +234,10 @@ function moduleThrewError(id, error: any) { if (__DEV__) { require.Systrace = {beginEvent: () => {}, endEvent: () => {}}; + require.getModules = () => { + return modules; + }; + // HOT MODULE RELOADING var createHotReloadingObject = function() { const hot: HotModuleReloadingData = { diff --git a/packages/metro-bundler/src/integration_tests/__tests__/__snapshots__/basic_bundle-test.js.snap b/packages/metro-bundler/src/integration_tests/__tests__/__snapshots__/basic_bundle-test.js.snap index cfc04504..d8b61455 100644 --- a/packages/metro-bundler/src/integration_tests/__tests__/__snapshots__/basic_bundle-test.js.snap +++ b/packages/metro-bundler/src/integration_tests/__tests__/__snapshots__/basic_bundle-test.js.snap @@ -159,6 +159,10 @@ if (__DEV__) { (function () { _require.Systrace = { beginEvent: function beginEvent() {}, endEvent: function endEvent() {} }; + _require.getModules = function () { + return modules; + }; + createHotReloadingObject = function createHotReloadingObject() { var hot = { acceptCallback: null, @@ -437,6 +441,10 @@ if (__DEV__) { (function () { _require.Systrace = { beginEvent: function beginEvent() {}, endEvent: function endEvent() {} }; + _require.getModules = function () { + return modules; + }; + createHotReloadingObject = function createHotReloadingObject() { var hot = { acceptCallback: null,