diff --git a/react-packager/src/Bundler/index.js b/react-packager/src/Bundler/index.js index 22696cf5..9da681d6 100644 --- a/react-packager/src/Bundler/index.js +++ b/react-packager/src/Bundler/index.js @@ -168,9 +168,9 @@ class Bundler { }); } - _sourceHMRURL(platform, path) { + _sourceHMRURL(platform, host, port, path) { return this._hmrURL( - 'http://localhost:8081', // TODO: (martinb) avoid hardcoding + `http://${host}:${port}`, platform, 'bundle', path, @@ -211,10 +211,10 @@ class Bundler { ); } - hmrBundle(options) { + hmrBundle(options, host, port) { return this._bundle({ bundle: new HMRBundle({ - sourceURLFn: this._sourceHMRURL.bind(this, options.platform), + sourceURLFn: this._sourceHMRURL.bind(this, options.platform, host, port), sourceMappingURLFn: this._sourceMappingHMRURL.bind( this, options.platform, diff --git a/react-packager/src/Server/index.js b/react-packager/src/Server/index.js index 7db64bf7..5949bd0c 100644 --- a/react-packager/src/Server/index.js +++ b/react-packager/src/Server/index.js @@ -240,8 +240,8 @@ class Server { return this.buildBundle(options); } - buildBundleForHMR(modules) { - return this._bundler.hmrBundle(modules); + buildBundleForHMR(modules, host, port) { + return this._bundler.hmrBundle(modules, host, port); } getShallowDependencies(entryFile) {