refactor!: move side effect of restart server to the caller#8746
refactor!: move side effect of restart server to the caller#8746bluwy merged 5 commits intovitejs:mainfrom
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. |
|
Oh, there is a conflict, I think you can merge it once it is resolved then. |
Description
make
restartfunction 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).