quick fix for HTTPS port from env not working properly by allowing env HMR_PORT
alongside env PORT
#9715
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
↪️ Pull Request
quick fix for #9345
However, I do not like the fact that
normalizeOptions
is a) responsible for invokinggetPort
as a fallback & b) unaware ofenv.PORT
.This will at least solve the immediate issue #9345 and maybe a better refactor of the sequence of these checks can be done later.
💻 Examples
Steps to repro: (from
v2
branch)run two parcel projects, both with
PORT=
andHMR_PORT=
in the.env
and the--https
option (no--port
option)the two parcel projects you start up should have different non-conflicting port numbers in their
.env
You will notice that the 2nd one givs an error about port 1234 being taken despite the fact that you have
PORT
specified in env. The reason for this is the first project, while it respectsPORT
for the https server, is silently running and HMR server on port 1234.So what you will find is the 2nd parcel project you start up is picking a port number randomly with
getPort
.However, if you use this PR, you will see that you can run multiple
--https
parcel projects with no port conflicts by relying only on.env
configuration and no need to set--port
(which in our case we are trying to avoid)🚨 Test instructions
✔️ PR Todo