From f9a9cd6f25cf56956b078155e0805cd894f11a56 Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Wed, 6 Apr 2016 12:13:36 -0700 Subject: [PATCH] Fixes hotcode reloading issue Reviewed By: martinbigio Differential Revision: D3136032 fb-gh-sync-id: 5666fd45ffa574d2156b03c7bfbda3fe97090f56 fbshipit-source-id: 5666fd45ffa574d2156b03c7bfbda3fe97090f56 --- react-packager/src/Bundler/index.js | 9 +++++---- react-packager/src/Resolver/polyfills/require.js | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) 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; }