Skip to content

fix(server): the server restart port should remain unchanged#14418

Merged
patak-cat merged 9 commits intovitejs:mainfrom
btea:fix/server-restart-port-change
Nov 8, 2023
Merged

fix(server): the server restart port should remain unchanged#14418
patak-cat merged 9 commits intovitejs:mainfrom
btea:fix/server-restart-port-change

Conversation

@btea
Copy link
Copy Markdown
Contributor

@btea btea commented Sep 20, 2023

Description

  1. Start a project, the default port is 5173.
  2. Start another project, because the default port is already in use, so the listening port after the project is started is 5174.
  3. Close the first project.
  4. At this point, modifying the configuration file of the second project, such as the '.env' file, causes the server to restart. Since the second project may already be in the access state, I think the port that was listening on before should be maintained.

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@btea btea requested a review from ArnaudBarre October 31, 2023 09:11
ArnaudBarre
ArnaudBarre previously approved these changes Nov 4, 2023
Copy link
Copy Markdown
Member

@ArnaudBarre ArnaudBarre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also ok with @patak-dev of moving the to the listen part, this maybe better to not update the user config even if it means having a bit more complexity to manage this internal state

@btea
Copy link
Copy Markdown
Contributor Author

btea commented Nov 6, 2023

@ArnaudBarre Already modified as @patak-dev suggested and added the comments you provided. ❤

@patak-cat patak-cat added the p3-minor-bug An edge case that only affects very specific usage (priority) label Nov 6, 2023
@patak-cat patak-cat merged commit 8b96e97 into vitejs:main Nov 8, 2023
@btea btea deleted the fix/server-restart-port-change branch November 8, 2023 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p3-minor-bug An edge case that only affects very specific usage (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants