-
-
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
fix: use the host in options to check if port is available #4385
Conversation
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.
These changes should result in the same code executing as before if the host is localhost. I think the case where someone wants the dev server to listen on non-localhost must be fairly rare.
@@ -716,9 +717,9 @@ declare class Server { | |||
description: string; | |||
multiple: boolean; | |||
path: string; | |||
type: string; | |||
type: string /** @type {WebSocketURL} */; |
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.
Regenerating the Server types introduces a lot unrelated comments in the type definitions, but running build:types
on master does not create any diff.
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.
Hmm, types changed here since you added * @param {string} host
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.
It is bug in ts, reported about it, but still not fixed
Codecov Report
@@ Coverage Diff @@
## master #4385 +/- ##
==========================================
+ Coverage 92.27% 92.42% +0.14%
==========================================
Files 16 16
Lines 1593 1597 +4
Branches 596 598 +2
==========================================
+ Hits 1470 1476 +6
+ Misses 114 112 -2
Partials 9 9
Continue to review full report at Codecov.
|
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.
LGTM, thanks!
@@ -406,7 +407,7 @@ class Server { | |||
? parseInt(process.env.WEBPACK_DEV_SERVER_PORT_RETRY, 10) | |||
: 3; | |||
|
|||
return pRetry(() => getPort(basePort), { |
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.
I am not sure retry
is going to help a lot as the getPort()
(and portfinder) before is going to try every port up to the maximum port number anyway, but it was introduced on purpose in this commit back in 2019, so there might be a reason.
Thanks |
For Bugs and Features; did you add new tests?
Yes, but it is hard to test for non-localhost hosts.
Motivation / Use-Case
The server should check if the port is available on the host specified by the user.
Breaking Changes
No breaking changes.
Additional Info