-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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: close vite dev server before creating new one #4374
Conversation
Build is talking about that you need to remove |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: does this affect #3182 somehow?
@tjk please remove the draft status when you are ready to merge |
Will test different combinations in a minimal repro and then remove draft status after an update. Thanks! |
@Shinigami92 is there a good reason that If you already have a vite dev server running with default config: $ yarn workspace test-ssr-vue dev
yarn workspace v1.22.5
yarn run v1.22.5
$ node server
http://localhost:3000
[Vue Router warn]: No match found for location with path "/favicon.ico"
[Vue warn]: <Suspense> slots expect a single root node.
[Vue Router warn]: No match found for location with path "/favicon.ico"
[Vue warn]: <Suspense> slots expect a single root node.
[@vue/compiler-sfc] <script setup> is still an experimental proposal.
Follow its status at https://github.com/vuejs/rfcs/pull/227.
[@vue/compiler-sfc] When using experimental features,
it is recommended to pin your vue dependencies to exact versions to avoid breakage.
[Vue Router warn]: No match found for location with path "/favicon.ico"
[Vue warn]: <Suspense> slots expect a single root node.
[Vue Router warn]: No match found for location with path "/favicon.ico"
[Vue warn]: <Suspense> slots expect a single root node.
[Vue Router warn]: No match found for location with path "/favicon.ico"
[Vue warn]: <Suspense> slots expect a single root node.
[Vue Router warn]: No match found for location with path "/favicon.ico"
[Vue warn]: <Suspense> slots expect a single root node.
[Vue Router warn]: No match found for location with path "/favicon.ico"
[Vue warn]: <Suspense> slots expect a single root node.
[Vue Router warn]: No match found for location with path "/favicon.ico"
[Vue warn]: <Suspense> slots expect a single root node. So getting the following is helpful: $ yarn workspace test-ssr-vue dev
yarn workspace v1.22.5
yarn run v1.22.5
$ node server
WebSocket server error:
Error: listen EADDRINUSE: address already in use :::24678
at Server.setupListenHandle [as _listen2] (net.js:1313:16)
at listenInCluster (net.js:1361:12)
at Server.listen (net.js:1447:7)
at new WebSocketServer (/home/tjk/src/github.com/tjk/vite/packages/vite/dist/node/chunks/dep-e21de3b6.js:61872:20)
at createWebSocketServer (/home/tjk/src/github.com/tjk/vite/packages/vite/dist/node/chunks/dep-e21de3b6.js:62281:15)
at Object.createServer (/home/tjk/src/github.com/tjk/vite/packages/vite/dist/node/chunks/dep-e21de3b6.js:73607:16)
at async createServer (/home/tjk/src/github.com/tjk/vite/packages/playground/ssr-vue/server.js:30:12)
http://localhost:3000
[Vue Router warn]: No match found for location with path "/favicon.ico"
[Vue warn]: <Suspense> slots expect a single root node.
[Vue Router warn]: No match found for location with path "/favicon.ico"
[Vue warn]: <Suspense> slots expect a single root node.
... |
I personally don't know 🤷 You need to ask someone else |
Ack. That line is 8 months old. @yyx990803 do you remember a good reason for this? EDIT: see my comment above... it would be nice for the behavior from the client to also be better but I don't have any obvious ideas yet (in terms of not just spin refreshing if the HMR port is down) EDIT: (to be clear, this PR currently only addresses re-binding to the same HMR ws port correctly on dev server restart at the moment) |
I left comments on that other PR (#3182 (review)). As it stands, this issue happens in |
I agree, should we mark this one as ready to merge and out of draft then @tjk? |
question: if a |
I imagine so. Is there a particular scenario you are worried would not work? I'm happy to test cases that might be borked, just let me know please. |
I'm away for the day but can check the behavior when I extend the time
between close and restart this evening and get back to you.
On Sun, Jul 25, 2021 at 12:13 PM patak ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In packages/vite/src/node/server/hmr.ts
<#4374 (comment)>:
> @@ -467,18 +466,19 @@ async function readModifiedFile(file: string): Promise<string> {
async function restartServer(server: ViteDevServer) {
// @ts-ignore
global.__vite_start_time = Date.now()
+
+ await server.close()
@tjk <https://github.com/tjk> just to check, I think the current pattern
was used to avoid missing requests from the client, no? Did you analyze
what happened in this case? The user may get a few network errors but the
page is reloaded?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4374 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA2VKA5CQ2CETZTR4WBRX3TZRO5LANCNFSM5A4W5A4Q>
.
--
TJ Koblentz
|
(moved to review thread) |
For reference there is a new issue and PR #4460 related to the way the server is restarting. @tjk did you thought about splitting I would like to merge this PR and we can continue to explore how to improve here. But I see that we don't have an issue related to it. @tjk would it be possible for you to create a bug report with a minimal reproduction so we can better track this change? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
Without this change, when touching vite config (for example), vite logs
[vite] server restarted.
and then client reconnect loops because it can never reestablish connection to websocket port (since it was not bound correctly).What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).