From f6e2e179009057658e06082d754fde28f055fc2e Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Mon, 18 Sep 2017 08:56:18 -0700 Subject: [PATCH] HMR: Include updated modules in the correct order Reviewed By: davidaurelio Differential Revision: D5852269 fbshipit-source-id: 519564a4899b22d16a2ab3be4b466e21783e8f86 --- packages/metro-bundler/src/HmrServer/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/metro-bundler/src/HmrServer/index.js b/packages/metro-bundler/src/HmrServer/index.js index d91a978c..ee0619fd 100644 --- a/packages/metro-bundler/src/HmrServer/index.js +++ b/packages/metro-bundler/src/HmrServer/index.js @@ -129,7 +129,10 @@ class HmrServer { // The Delta Bundle can have null objects: these correspond to deleted // modules, which we don't need to send to the client. if (module != null) { - modules.push({id, code: module.code}); + // When there are new modules added on the dependency tree, they are + // appended on the Delta Bundle, but HMR needs to have them at the + // beginning. + modules.unshift({id, code: module.code}); } }