Skip to content

Commit

Permalink
Only attach hmrServer after successfully listen on port
Browse files Browse the repository at this point in the history
Reviewed By: rafeca

Differential Revision: D14006025

fbshipit-source-id: da650ba5482f02b12e1889dc7a6fadaf900019d0
  • Loading branch information
Wendy Huang authored and facebook-github-bot committed Feb 11, 2019
1 parent 4e83f59 commit 0ca9b05
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/metro/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,12 @@ exports.runServer = async (
end();
});

if (hmrEnabled) {
attachHmrServer(httpServer);
}

return new Promise((resolve, reject) => {
httpServer.listen(config.server.port, host, () => {
onReady && onReady(httpServer);
if (hmrEnabled) {
attachHmrServer(httpServer);
}
resolve(httpServer);
});

Expand Down

0 comments on commit 0ca9b05

Please sign in to comment.