I'm trying to close webpack dev server programatically, so I can run it it task with webdriverio.
The webpack API already provides _listen_ method which delegates listen call and inits socket.io. I tried to add close method with similar functionality, but couldn't get it work (the process still hangs).
Server.prototype.close = function(callback) {
this.io.close();
this.io = null;
this.listeningApp.close(callback);
this.listeningApp = null;
}
Any ideas?
Fixed
Hi,
How i can stop webpack-dev-server programaticaly ? like webpack-dev-server close() for example ...
Like you said, with close()?
i used but nothing happen.. :(
Which version of dev-server are you using? Can you share the relevant part of your code?
version : 1.14.1
var WebpackDevServer = require("webpack-dev-server");
var webpack = require("webpack");
`var compiler = webpack({
......
.....
});
var server = new WebpackDevServer(compiler, {
});
server.listen(3000, "localhost", function() {});
server.close();
`
the server started but not closed.
thank you for your help.
Can you try changing localhost to 127.0.0.1? This causes a lot of weird errors (see #183).
Hi,
nothing changed.
@SpaceK33z, have the same issue, "webpack-dev-server": "^2.4.2", the server is alive even after calling stop() method. Do you have any idea why it happens?
Same here..
After I call the close method, the server still seems to be alive although it no longer is using the port.