mirror of https://github.com/status-im/metro.git
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:
parent
02feea9a5a
commit
9de2ed3d48
|
@ -168,9 +168,9 @@ class Bundler {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_sourceHMRURL(platform, path) {
|
_sourceHMRURL(platform, host, port, path) {
|
||||||
return this._hmrURL(
|
return this._hmrURL(
|
||||||
'http://localhost:8081', // TODO: (martinb) avoid hardcoding
|
`http://${host}:${port}`,
|
||||||
platform,
|
platform,
|
||||||
'bundle',
|
'bundle',
|
||||||
path,
|
path,
|
||||||
|
@ -211,10 +211,10 @@ class Bundler {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
hmrBundle(options) {
|
hmrBundle(options, host, port) {
|
||||||
return this._bundle({
|
return this._bundle({
|
||||||
bundle: new HMRBundle({
|
bundle: new HMRBundle({
|
||||||
sourceURLFn: this._sourceHMRURL.bind(this, options.platform),
|
sourceURLFn: this._sourceHMRURL.bind(this, options.platform, host, port),
|
||||||
sourceMappingURLFn: this._sourceMappingHMRURL.bind(
|
sourceMappingURLFn: this._sourceMappingHMRURL.bind(
|
||||||
this,
|
this,
|
||||||
options.platform,
|
options.platform,
|
||||||
|
|
|
@ -240,8 +240,8 @@ class Server {
|
||||||
return this.buildBundle(options);
|
return this.buildBundle(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
buildBundleForHMR(modules) {
|
buildBundleForHMR(modules, host, port) {
|
||||||
return this._bundler.hmrBundle(modules);
|
return this._bundler.hmrBundle(modules, host, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
getShallowDependencies(entryFile) {
|
getShallowDependencies(entryFile) {
|
||||||
|
|
Loading…
Reference in New Issue