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}); } }