Skip to content

Commit

Permalink
fix(bundling): fix baseUrl resolution for vite dev server (#13219)
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini committed Nov 17, 2022
1 parent 2bc9e84 commit 2802b6f
Showing 1 changed file with 6 additions and 5 deletions.
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

0 comments on commit 2802b6f

Please sign in to comment.