-
Notifications
You must be signed in to change notification settings - Fork 14
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
options.port default to 3000, even in the presence of options.ports #67
Comments
Yes. It does seem a little counter-intuitive that there are times when we don't want the |
Not sure what you mean. My case is that I have not defined If this is expected behavior, it should be documented that you can't use |
I think it makes sense to prefer custom port yrange when provided. Feel free to make a PR! |
Environment
Node v18 (but I think it is universal)
Reproduction
The following repo gets the port 3000 unexpectedly: https://github.com/nuxt-modules/storybook/blob/main/src/storybook.ts (see line 11)
Here is the shortest snippet that reproduces the bug:
Describe the bug
In the file get-ports.ts (https://github.com/unjs/get-port-please/blob/main/src/get-port.ts) on line 29 - the port option defaults to 3000 (unless otherwise defined in _userOptions). On line 53 in the same file, the same value is assigned a higher priority than the actually provided option
ports
. This makes the ports and portRange options hard to use.If this behavior is intentional, it would be convenient if it was documented.
A suggested fix would be to add the default port to the end of
portToCheck
and unshift _userOptions.port to the front of the same array if it is provided.Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: