mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Don't hardcode 'localhost:8081' as the _hmrURL in the Bundler
Summary:martinbigio this fixes your TODO. 🚀 🚀 🚀 Closes https://github.com/facebook/react-native/pull/5827 Differential Revision: D2932188 Pulled By: martinbigio fb-gh-sync-id: 8c8caf0782f05b51c90c8d09fdb743ddd3e6f97e shipit-source-id: 8c8caf0782f05b51c90c8d09fdb743ddd3e6f97e
This commit is contained in:
committed by
Facebook Github Bot 1
parent
20588a6bf8
commit
b2b41da37f
@@ -185,11 +185,23 @@ function attachHMRServer({httpServer, path, packagerServer}) {
|
||||
return;
|
||||
}
|
||||
|
||||
const httpServerAddress = httpServer.address();
|
||||
|
||||
// Sanitize the value from the HTTP server
|
||||
let packagerHost = 'localhost';
|
||||
if (httpServer.address().address &&
|
||||
httpServer.address().address !== '::' &&
|
||||
httpServer.address().address !== '') {
|
||||
packagerHost = httpServerAddress.address;
|
||||
}
|
||||
|
||||
let packagerPort = httpServerAddress.port;
|
||||
|
||||
return packagerServer.buildBundleForHMR({
|
||||
entryFile: client.bundleEntry,
|
||||
platform: client.platform,
|
||||
resolutionResponse,
|
||||
});
|
||||
}, packagerHost, packagerPort);
|
||||
})
|
||||
.then(bundle => {
|
||||
if (!client || !bundle || bundle.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user