webpack-dev-server: 1.13.0 [WS] Disconnected, net::ERR_CONNECTION_REFUSED
For versions greater than 1.12.1 The WebSocket connection seems to be broken.
In the console I get the errors:
GET http://localhost/info?t=1448470960512 net::ERR_CONNECTION_REFUSED
[WDS] Disconnected!
My Webpack Config looks like this:
{
//....
plugins: [
new webpack.HotModuleReplacementPlugin(),
],
devServer: {
contentBase: "./app/static",
port: 3000,
inline: true,
historyApiFallback: true,
colors: true,
stats: 'normal',
},
}
As you can see the port is set to 3000 and I also access the page via http://localhost:3000/
but the WebSocket connections seems to ignore the port and tries to connect to http://localhost/info
I am new to webpack so I am not quite sure if I am doing something wrong but as it was working a few days ago and also works if I downgrade to 1.12.1 I suppose it’s an error with webpack-dev-server.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 3
- Comments: 33 (5 by maintainers)
Commits related to this issue
- Fix an issue in webpack-dev-server module By downgrade to version 1.12.1, see https://github.com/webpack/webpack-dev-server/issues/326 — committed to tommytroylin/CommunityHealthMonitoringSystem by tommytroylin 9 years ago
- Apply fix to part1/example6/webpack.config.dev.js to enable HMR This issue is referenced here: https://github.com/webpack/webpack-dev-server/issues/326 Signed-off-by: Ian Hilt <ian.hilt@gmail.com> — committed to ihilt/WebpackTutorial by ihilt 8 years ago
- Update webpack-dev-server docs for proper app entry point when using HMR (see https://github.com/webpack/webpack-dev-server/issues/326) — committed to youshengyouse/doc_webpack by sohkai 8 years ago
- Silence annoying webpack console spam Per: https://github.com/webpack/webpack-dev-server/issues/326 — committed to wincent/masochist by wincent 7 years ago
Nope, it was my webpack config.
changing the first line in the App array fixed it.
webpack-dev-server/client?http://localhost:8080/
fixed:
webpack-config.js
@timwingfield yes, we use under Rails. I fix it with changing config. Pretty much the same stuff, but I have multiply entries
Got it all working now. Thanks @SpaceK33z and @savroff
Did you make sure to use the same port in the
devServer.port
andwebpack-dev-server/client?{url}
?FWIW, @SohKai’s fix doesn’t seem to work when
--content-base
is provided as an argument,e.g. given a project in which the source is in
./src
, a package.json script might be configured as:@timwingfield, the url should be
/sockjs-node/info
. Where does/assets/
come from?@SpaceK33z finally had a chance to come back to this. Looks like it’s working for others which is great, but I’m experiencing the same symptom (server logs say
15.12.18 08:10:16 404 GET /sockjs-node/info (Unknown - 1ms)
). I completely reinstalled webpack-dev-server (removed the directory, installedwebpack/webpack-dev-server#3d3c000df8889e8b557995e5fe918b29072c377f
, and rannpm install && npm run prepublish
within the webpack-dev-server directory).Do I need to include an expicit dependency on sockjs and set up the server myself within my own app?
EDIT: I had webpack-dev-server listening to port 3001, setting up a proxy to my app running on port 8124. The requests to
/sockjs-node/info
were against my app port (8124), not my webpack-dev-server port (3001). Looks like proxying has changed since the version I was on previously (1.10.1), I’ll look into how proxying is supposed to work now.