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(bundling): fix baseUrl resolution for vite dev server #13219

Merged
merged 1 commit into from Nov 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions packages/vite/src/executors/dev-server/dev-server.impl.ts
Expand Up @@ -44,13 +44,11 @@ export default async function* viteDevServerExecutor(

const server = await createServer(serverConfig);

await runViteDevServer(server, assetsResult);
const baseUrl = await runViteDevServer(server, assetsResult);

yield {
success: true,
baseUrl: `${mergedOptions.https ? 'https' : 'http'}://${
mergedOptions.host ?? 'localhost'
}:${mergedOptions.port ?? 4200}`,
baseUrl: baseUrl,
};

// This Promise intentionally never resolves, leaving the process running
Expand All @@ -60,7 +58,7 @@ export default async function* viteDevServerExecutor(
async function runViteDevServer(
server: ViteDevServer,
assetsResult: CopyAssetsResult
) {
): Promise<string> {
try {
await server.listen();
server.printUrls();
Expand All @@ -75,6 +73,9 @@ async function runViteDevServer(
process.on('SIGINT', processOnExit);
process.on('SIGTERM', processOnExit);
process.on('exit', processOnExit);
return `${server.config?.server?.https ? 'https' : 'http'}://${
server.config?.server?.host
}:${server.config?.server?.port}`;
} catch (err) {
console.log(err);
}
Expand Down