-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Get the port from the options object #1079
Conversation
When listeningApp is not supplied, use the port from the options object.
Codecov Report
@@ Coverage Diff @@
## master #1079 +/- ##
=======================================
Coverage 72.39% 72.39%
=======================================
Files 5 5
Lines 460 460
Branches 147 147
=======================================
Hits 333 333
Misses 127 127
Continue to review full report at Codecov.
|
@@ -6,7 +6,7 @@ const internalIp = require('internal-ip'); | |||
|
|||
module.exports = function createDomain(options, listeningApp) { | |||
const protocol = options.https ? 'https' : 'http'; | |||
const appPort = listeningApp ? listeningApp.address().port : 0; | |||
const appPort = listeningApp ? listeningApp.address().port : options.port.toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will break dynamic port assignment, port 0
was intentional there for that reason.
What side effects is this causing? |
@shellscape |
@binhqx this can be resolved by stubbing the {
address() {
return { port: options.port };
}
} And should allow everything else to function normally. The CLI is doing a few things a little out of order. If we find that we have to stub in more than one place, we'll refactor. But since that's a util function it shouldn't be a big deal. |
@binhqx would you like to do that in your PR or would you like me to? |
@shellscape You are much more familiar with the code. You can fix it your way. |
What kind of change does this PR introduce?
bugfix
Did you add or update the
examples/
?No
Summary
When listeningApp is not supplied, use the port from the options object. I think this functionally was broken by PR: https://github.com/webpack/webpack-dev-server/pull/1054/files#diff-07cfeb70272594b38ac9139434c94502
Does this PR introduce a breaking change?
No
Other information