Skip to content
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

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

Merged
merged 9 commits into from
Nov 8, 2023

Conversation

btea
Copy link
Collaborator

@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.

@stackblitz
Copy link

stackblitz bot commented Sep 20, 2023

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
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

packages/vite/src/node/server/index.ts Outdated Show resolved Hide resolved
@btea
Copy link
Collaborator Author

btea commented Nov 6, 2023

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

packages/vite/src/node/server/index.ts Outdated Show resolved Hide resolved
packages/vite/src/node/server/index.ts Outdated Show resolved Hide resolved
@patak-dev patak-dev added the p3-minor-bug An edge case that only affects very specific usage (priority) label Nov 6, 2023
@patak-dev patak-dev merged commit 8b96e97 into vitejs:main Nov 8, 2023
10 checks passed
@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