Skip to content

Commit

Permalink
feat: update the assignment method of host in baseUrl (#3943)
Browse files Browse the repository at this point in the history
Co-authored-by: 储俊雄 <[email protected]>
  • Loading branch information
junxiongchu and 储俊雄 authored Nov 13, 2024
1 parent 17e80be commit 81faeac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/core/src/server/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export async function open({
clearCache?: boolean;
}): Promise<void> {
const { targets, before } = normalizeOpenConfig(config);
const host = config.server.host || 'localhost';

// Skip open in codesandbox. After being bundled, the `open` package will
// try to call system xdg-open, which will cause an error on codesandbox.
Expand All @@ -154,7 +155,7 @@ export async function open({

const urls: string[] = [];
const protocol = https ? 'https' : 'http';
const baseUrl = `${protocol}://localhost:${port}`;
const baseUrl = `${protocol}://${host}:${port}`;

if (!targets.length) {
if (routes.length) {
Expand Down

0 comments on commit 81faeac

Please sign in to comment.