Skip to content

Commit

Permalink
Use devServer.port if it's configured
Browse files Browse the repository at this point in the history
Fixes #423
  • Loading branch information
insin committed Jan 26, 2018
1 parent cd2ed69 commit 6a5ba9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Changed

- `port` config in [`devServer` config](https://github.com/insin/nwb/blob/master/docs/Configuration.md#devserver-object) will now be used if configured [[#423](https://github.com/insin/nwb/issues/423)]

# 0.21.2 / 2018-01-17

## Fixed
Expand Down
7 changes: 2 additions & 5 deletions src/webpackServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import {clearConsole, deepToString} from './utils'
* Get the port to run the server on, detecting if the intended port is
* available first and prompting the user if not.
*/
function getServerPort(args, cb) {
let intendedPort = args.port || DEFAULT_PORT

function getServerPort(args, intendedPort, cb) {
detect(intendedPort, (err, suggestedPort) => {
if (err) return cb(err)
// No need to prompt if the intended port is available
Expand Down Expand Up @@ -65,8 +63,7 @@ export default function webpackServer(args, buildConfig, cb) {
return cb(e)
}

// Other config can be provided by the user via the CLI
getServerPort(args, (err, port) => {
getServerPort(args, args.port || serverConfig.port || DEFAULT_PORT, (err, port) => {
if (err) return cb(err)
// A null port indicates the user chose not to run the server when prompted
if (port === null) return cb()
Expand Down

0 comments on commit 6a5ba9a

Please sign in to comment.