-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
refactor!: move side effect of restart server to the caller #8746
Conversation
✅ Deploy Preview for vite-docs-main ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Would you explain why we would like to avoid the printing of the new URLs when calling |
User may use Javascript API, import { createServer } from "vite";
import { SHOULD_PRINT_URL } from "./consts";
const server = await createServer({ base: "/a/", configFile: false });
SHOULD_PRINT_URL && server.printUrls();
async function restartServer() {
await server.restart();
SHOULD_PRINT_URL && server.printUrls();
}
// ...
server.config.inlineConfig.base = "/b/";
restartServer(); |
The printing code was added without considering that the |
This makes sense to me partially. But when metaframeworks that uses We might need to think about #6997 (comment) and #8986 together with this PR. |
@CHOYSEN would you rebase this PR? Let's try to merge it for Vite 5, or otherwise decide if we prefer to keep things as is. |
sure |
/ecosystem-ci run |
📝 Ran ecosystem CI on
|
The more I think about it, the more I'm unsure this is the right fix. This PR moves the |
Added the printing for shortcuts, but I'm still not sure if this is the right solution. |
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.
I think your latest changes looks good @bluwy, let's go with this approach
Oh, there is a conflict, I think you can merge it once it is resolved then. |
Description
make
restart
function more pure after expose it as a javascript APIWhat is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).