Skip to content

Add API to close dev server #249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tricoder42 opened this issue Sep 1, 2015 · 11 comments
Closed

Add API to close dev server #249

tricoder42 opened this issue Sep 1, 2015 · 11 comments

Comments

@tricoder42
Copy link

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?

@jhchen jhchen mentioned this issue Oct 6, 2015
@TheLarkInn
Copy link
Member

Fixed

@cbelhaffef
Copy link

Hi,
How i can stop webpack-dev-server programaticaly ? like webpack-dev-server close() for example ...

@SpaceK33z
Copy link
Member

Like you said, with close()?

@cbelhaffef
Copy link

i used but nothing happen.. :(

@SpaceK33z
Copy link
Member

Which version of dev-server are you using? Can you share the relevant part of your code?

@cbelhaffef
Copy link

cbelhaffef commented Aug 31, 2016

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.

@SpaceK33z
Copy link
Member

Can you try changing localhost to 127.0.0.1? This causes a lot of weird errors (see #183).

@cbelhaffef
Copy link

Hi,
nothing changed.

@pavel06081991
Copy link

@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?

@pkearney13
Copy link

Same here..

@ozyman42
Copy link

ozyman42 commented Dec 27, 2018

After I call the close method, the server still seems to be alive although it no longer is using the port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants