diff --git a/react-packager/src/Bundler/index.js b/react-packager/src/Bundler/index.js index b8bfb6ba..a6041e40 100644 --- a/react-packager/src/Bundler/index.js +++ b/react-packager/src/Bundler/index.js @@ -390,10 +390,11 @@ class Bundler { const numModuleSystemDependencies = this._resolver.getModuleSystemDependencies({dev, unbundle}).length; - entryFilePath = response.dependencies[ - (response.numPrependedDependencies || 0) + - numModuleSystemDependencies - ].path; + + const dependencyIndex = (response.numPrependedDependencies || 0) + numModuleSystemDependencies; + if (dependencyIndex in response.dependencies) { + entryFilePath = response.dependencies[dependencyIndex].path; + } } const toModuleTransport = module => diff --git a/react-packager/src/Resolver/polyfills/require.js b/react-packager/src/Resolver/polyfills/require.js index 05fa02dc..28a3c2ae 100644 --- a/react-packager/src/Resolver/polyfills/require.js +++ b/react-packager/src/Resolver/polyfills/require.js @@ -139,7 +139,7 @@ if (__DEV__) { // HMR } function acceptAll(modules, inverseDependencies) { - if (modules.length === 0) { + if (!modules || modules.length === 0) { return true; }