Merged
Conversation
89b1b99 to
ab27921
Compare
ab27921 to
b0dce82
Compare
sapphi-red
approved these changes
Dec 5, 2025
Member
sapphi-red
left a comment
There was a problem hiding this comment.
Thanks! I've pushed a commit to simplify the state handling a bit.
ArnaudBarre
approved these changes
Dec 5, 2025
sapphi-red
added a commit
that referenced
this pull request
Dec 8, 2025
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
sapphi-red
added a commit
to vitejs/rolldown-vite
that referenced
this pull request
Dec 12, 2025
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix #21166
I am terribly sorry having to come back to this the 3rd time. My previous attempt resolves the server restart issue only when no plugin defines their own shortcut using
server.bindCliShortcuts().When a plugin defines its own custom shortcut (e.g.
x + enter), it works fine when the dev server is just started:However, if you change the shortcut message to
Hello updated serverdefined in the config file and save it, the server restarts and this happens:Here is a reproduction: https://github.com/edmundhung/vite-plugin-shortcut-issue
The issue here is when
restartServer()creates a new server and the plugin callsserver.bindCLIShortcuts(), a readline interface is also created. It gets detached because of my changes in #21166:vite/packages/vite/src/node/server/index.ts
Lines 1254 to 1255 in 5d2c31f
Another readline interface then get created with the stale shortcut options (the one that logs
Hello Worldinstead of the updatedHello updated servermessage) invite/packages/vite/src/node/server/index.ts
Lines 1280 to 1288 in 5d2c31f
Initially, I tried detaching the
server._rlinstance instead so we preserve the new readline instance created in the plugin:But it runs into another issue: closing a readline interface on
process.stdincauses already opened readline interfaces to stop receiving input.This PR:
_rl) across server restart (avoids issues when closing/reopening readline)_shortcutsOptionsto the new server so plugin shortcuts can be properly merged when plugin register custom shortcut