Skip to content

listening as both https and http server simultaneously #126

Open
@kwindla

Description

@kwindla

Hi,

I'm moving a project over from browserify to webpack and hit a snag this afternoon. For arcane reasons (involving chrome and atom-shell/chromium behaviors) I need both https and http instances of local dev/testing web servers.

webpack-dev-server is awesome, but I didn't find any directly supported way to instantiate on two ports at the same time.

Here's what I ended up doing (full code context, farther down below)...

webpack_dev_server.listen(8004);
http.createServer(webpack_dev_server.app).listen (8005);

I'd like to ask whether this is a reasonable solution, or whether there's a better thing I should be doing, or alternatively whether a pull request to implement simultaneous https/http at the API level would be welcome.

Below, the full gulpfile.js chunk ...

var webpack = require ("webpack");
var WebpackDevServer = require ("webpack-dev-server");
var webpackConfig = require ("./webpack.config.js");
var http = require ('http');

gulp.task ("webpack-dev-server", function (callback) {
    // modify some webpack config options
    var myConfig = Object.create (webpackConfig);
    myConfig.devtool = "#source-map";
    myConfig.debug = true;

    // Start a webpack-dev-server
    var wds = new WebpackDevServer (webpack(myConfig), {
    https: true,
        publicPath: "/web",    // +   myConfig.output.publicPath,
        stats: {
            colors: true
        }
    });
  wds.listen(8004);
  http.createServer(wds.app).listen (8005);
});

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions