Uh oh!
There was an error while loading. Please reload this page.
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.
alexander-akait
commented
Apr 13, 2022
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. |
ludofischer
commented
Apr 13, 2022
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? |
ludofischer
commented
Apr 14, 2022
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. |
alexander-akait
commented
Apr 14, 2022
Thanks |
alexander-akait
commented
Apr 14, 2022
Let's fix a problem with host and I will do patch release |
ludofischer
commented
Apr 14, 2022
Do you mean fix the problem mentioned in #4384 (comment)? |
alexander-akait
commented
Apr 14, 2022
@ludofischer Yep 👍 |
ludofischer
commented
Apr 14, 2022
cjwilsontech
commented
May 2, 2022
@alexander-akait, any update on the patch release? |
alexander-akait
commented
May 2, 2022
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-portmaintainters. On the other hand there are more test failures with theget-portpackage and we would be stuck on the previous get-port major version, since it switched to ESM-only.