Skip to content

--port 0 argument is ignored #752

@also

Description

@also

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

When running webpack-dev-server --port 0, the port argument is ignored and the default, 8080, is used.

Port 0 is used to have the operating system assign a free ephemeral port. https://www.dnorth.net/2012/03/17/the-port-0-trick/ has a good explanation.

This worked in webpack-dev-server prior to #685.

If the current behavior is a bug, please provide the steps to reproduce.

Run any webpack project with webpack-dev-server --port 0. Port 8080 will be used if it is free.

What is the expected behavior?

With--port 0 (or options.port = 0), server.listen() should be called with port 0, allowing the OS to assign a free port.

If this isn't possible, --port 0 should cause an error rather than being ignored.

Please mention your webpack and Operating System version.

webpack-dev-server master (7e18f6a), webpack 2.2.0, macOS Sierra 10.12.2.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions