-
-
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
chore: replace portfinder with custom implementation #4384
chore: replace portfinder with custom implementation #4384
Conversation
Get rid of security warnings related to async dependencies Drop lodash from prod. The implementation is based mostly on the get-port package, but searches for ports incrementing by 1 like portfinder.
Can you clarify? |
Codecov Report
@@ Coverage Diff @@
## master #4384 +/- ##
==========================================
+ Coverage 92.18% 92.27% +0.09%
==========================================
Files 15 16 +1
Lines 1549 1593 +44
Branches 591 596 +5
==========================================
+ Hits 1428 1470 +42
- Misses 112 114 +2
Partials 9 9
Continue to review full report at Codecov.
|
For example you need to check the port on every local interface, else the port might look free even though it's already taken: webpack-dev-server/lib/getPort.js Line 18 in 983a0aa
Or the error codes you need to check for. This sort of thing someone who hasn't been maintaining a package like this for some time years will not understand. |
I also think there is a mistake in the current webpack-dev-server implementation. When you pass a custom host, the custom host is not passed to portfinder, so portfinder might check the ports on the wrong host. webpack-dev-server/lib/Server.js Line 3200 in c9b6433
Server.getFreePort() .
|
Yes, looks like a bug, let fix it too, do you want to fix it? If yes - here or in separate PR? |
SInce it's a longstanding bug I would fix it in a different PR. I think it's better to release the current PR on its own. |
Thanks |
Let's fix a problem with host and I will do patch release |
Do you mean fix the problem mentioned in #4384 (comment)? |
@ludofischer Yep 👍 |
@alexander-akait, any update on the patch release? |
Yep, today 👍 |
Fix #4383
For Bugs and Features; did you add new tests?
I've added new unit tests for the custom port finder implementation.
Motivation / Use-Case
Remove dependency on vulnerable package async, also remove dependency on lodash.
Breaking Changes
There should be no breaking changes.
Additional Info
I am in doubt whether to go with this or the get-port package as in https://github.com/ludofischer/webpack-dev-server/tree/switch-port-finder
The code is a bit complex because it needs to take into account differences across operating systems, so it might be useful to rely on the expertise of the
get-port
maintainters. On the other hand there are more test failures with theget-port
package and we would be stuck on the previous get-port major version, since it switched to ESM-only.