You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 3, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 3, 2026. It is now read-only.
The client cannot connect to the /__webpack_hmr endpoint #16
There's been a few issues with the eventsource polyfill - i'm going to revert those changes and unpublish 2.0.1 for now. Can revisit it with more testing.
@glenjamin don't you want to keep it working with non Express servers? E.g. when you need to launch a dev server by using BrowserSync (which uses Connect under the hood).
Without webpack running in my project, I consistently see requests to __webpack_hmr:
GET /__webpack_hmr 200 1.254 ms - 2092
GET /__webpack_hmr 200 3.087 ms - 2092
GET /__webpack_hmr 200 2.264 ms - 2092
When running my express server on a different port than what was used for my project using webpack, I can avoid these requests. They don't actually affect my project, but are extremely annoying. Is webpack_hmr running in the background? Is there a way to prevent this? @glenjamin
If you have the client in your bundle, it will continuously attempt to connect to the server. If you want to remove the client, you need to leave it out of the client bundle.
@glenjamin I know this is a little old but I am having the same problem @hoodsy is asking about. my my backend API are not bundle with client but stilling seeing the request to _webpack_hmr. You you help me understand what you mean by "If you want to remove the client, you need to leave it out of the client bundle."
@travisbmiller in your webpack config there's a line which adds the hot-middleware client to the bundle. If you leave this out, it won't attempt to connect to the server
@glenjamin Thanks for the response. I removed it 'webpack-hot-middleware/client', from entry in webpack, however I am still seeing requests on server. Not sure why that is.
@jsrraman If you add that into the config, it will connect to the server and perform the function this middleware is supposed to do.
If you take it out, it won't do anything. In the comments above people appeared to have disabled or moved the server component, but had left the client in.
@wassubaba Late to the party, but in case others stumble upon this, it looks like you forgot a slash after your hostname. The correct HMR URL should be your.domain/__webpack_hmr.
All in all, it would be great to be able to change the __webpack_hmr part into something custom. The use case is running one HMR at localhost, and another at localhost/foo. Without being able to specify a custom URL, it's necessary to do custom URL rewriting rules or use odd hacks to get it working.
Activity
Fix the __webpack_hmr endpoint not working
Add EventSource polyfill for IE
glenjamin commentedon Sep 15, 2015
What version of express are you using?
http://expressjs.com/4x/api.html#req.path should exist.
There's been a few issues with the eventsource polyfill - i'm going to revert those changes and unpublish
2.0.1for now. Can revisit it with more testing.glenjamin commentedon Sep 15, 2015
v2.0.1has been marked deprecated andv2.0.2released without the eventsource polyfill dfb7efbkoistya commentedon Sep 15, 2015
@glenjamin don't you want to keep it working with non Express servers? E.g. when you need to launch a dev server by using BrowserSync (which uses Connect under the hood).
glenjamin commentedon Sep 15, 2015
@koistya - I do want to work with non-express servers - yes!
I've closed this PR because the same change was made in dfb7efb
koistya commentedon Sep 15, 2015
Thanks!
2.0.2works fine with BrowserSync nowhoodsy commentedon Dec 1, 2015
Without webpack running in my project, I consistently see requests to __webpack_hmr:
When running my express server on a different port than what was used for my project using webpack, I can avoid these requests. They don't actually affect my project, but are extremely annoying. Is webpack_hmr running in the background? Is there a way to prevent this?
@glenjamin
glenjamin commentedon Dec 1, 2015
If you have the client in your bundle, it will continuously attempt to connect to the server. If you want to remove the client, you need to leave it out of the client bundle.
travisbmiller commentedon Nov 28, 2016
@glenjamin I know this is a little old but I am having the same problem @hoodsy is asking about. my my backend API are not bundle with client but stilling seeing the request to _webpack_hmr. You you help me understand what you mean by "If you want to remove the client, you need to leave it out of the client bundle."
Thanks
glenjamin commentedon Nov 28, 2016
@travisbmiller in your webpack config there's a line which adds the hot-middleware client to the bundle. If you leave this out, it won't attempt to connect to the server
travisbmiller commentedon Nov 28, 2016
@glenjamin Thanks for the response. I removed it
'webpack-hot-middleware/client',from entry in webpack, however I am still seeing requests on server. Not sure why that is.-- update -- it was a cache problem.
removing `'webpack-hot-middleware/client' fixed problem.
Thanks!
jsrraman commentedon Jan 1, 2017
@glenjamin Thanks for the direction. Removing 'webpack-hot-middleware/client' from 'entry' section fixed this.
Just wanted to understand, why this setting was suggested in the 'entry' section of react hot boilerplate?
glenjamin commentedon Jan 2, 2017
@jsrraman If you add that into the config, it will connect to the server and perform the function this middleware is supposed to do.
If you take it out, it won't do anything. In the comments above people appeared to have disabled or moved the server component, but had left the client in.
wassubaba commentedon Jun 30, 2017
Hi glenjamin,
I am getting the below exception while trying to connect from web to api.
"Uncaught DOMException: Failed to construct 'EventSource': Cannot open an EventSource to 'http://localhost:8080__webpack_hmr'. The URL is invalid."
Could you please help me to resolve this problem ?
maciej-gurban commentedon Jan 27, 2018
@wassubaba Late to the party, but in case others stumble upon this, it looks like you forgot a slash after your hostname. The correct HMR URL should be
your.domain/__webpack_hmr.All in all, it would be great to be able to change the
__webpack_hmrpart into something custom. The use case is running one HMR atlocalhost, and another atlocalhost/foo. Without being able to specify a custom URL, it's necessary to do custom URL rewriting rules or use odd hacks to get it working.