question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HMR/WDS client port ignored

See original GitHub issue

I’m upgrading one of my projects from webpack v1.x to v2.x (most recent beta). My setup can be illustrated as follows:

 Host OS              +-------------------------------------------+
                      | Linux VM (VMWare)                         |
                      |                                           |
+---------+   9081 +-----+    81 +-------+   8080 +------------+  |
| Browser |------->| NAT |------>| nginx |------->|   Webpack  |  |
|         |<-------|     |<------|       |<-------| dev-server |  |
+---------+        +-----+       +-------+        +------------+  |
                      |                                           |
                      +-------------------------------------------+

I have webpack-dev-server running in my VM on port 8080 and nginx acting as a reverse proxy. As I want to test my app on my host OS, I have set up the VMware NAT-Utility Service to forward requests on port 9081 (host) to port 81 (VM).

With webpack v.1x I got HMR working by adding the entry point webpack-dev-server/client?http://0.0.0.0:9081 to my webpack-config. But this seems to break with Webpack v2.x. The browser’s output suggests that client?http://0.0.0.0:9081 just gets ignored as request are issued to port 8080.

[HMR] Waiting for update signal from WDS...
[WDS] Hot Module Replacement enabled.
GET http://localhost:8080/sockjs-node/info?t=1479759389108 net::ERR_CONNECTION_REFUSED
[WDS] Disconnected!
GET http://localhost:8080/sockjs-node/info?t=1479759392164 net::ERR_CONNECTION_REFUSED
GET http://localhost:8080/sockjs-node/info?t=1479759396279 net::ERR_CONNECTION_REFUSED
GET http://localhost:8080/sockjs-node/info?t=1479759405260 net::ERR_CONNECTION_REFUSED

I’m not sure if this is a bug or if I’m missing something…

Here is my webpack-config (webpack-dev-server --config webpack.config.debugHot.js). Here the relevant part of my ngnix config for completeness.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

25reactions
SpaceK33zcommented, Nov 22, 2016

Ah I think I understand the issue. Since webpack v2, inline mode is enabled by default if you use the CLI. This means that it automatically included the webpack-devserver/client script. However, you also included that manually.

The cleanest way to fix it is to remove webpack-devserver/client from your entry. There are two ways to make WDS listen to the correct domain:

  1. webpack-dev-server --public=0.0.0.0:9081
  2. To the devServer object in your webpack config, add public:'0.0.0.0:9081'
3reactions
asterikxcommented, Nov 22, 2016

This solved my issue! Thanks a lot. Really appreciate your quick replies

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript – Page 2 - Stuff I'm Up To
What I was actually doing was HTML5 validation and ignoring my Laravel validation response all together. With the API it's best NOT to...
Read more >
Webpack实时刷新与模块热替换(HMR) - Rang's Note
HMR/WDS client port ignored · Running the server does not compile files or reload page in windows. Google搜索相对成本比较大,一方面是“技术” ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found