Skip to content

Commit 81faeac

Browse files
junxiongchu储俊雄
andauthored
feat: update the assignment method of host in baseUrl (#3943)
Co-authored-by: 储俊雄 <[email protected]>
1 parent 17e80be commit 81faeac

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/core/src/server/open.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ export async function open({
139139
clearCache?: boolean;
140140
}): Promise<void> {
141141
const { targets, before } = normalizeOpenConfig(config);
142+
const host = config.server.host || 'localhost';
142143

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

155156
const urls: string[] = [];
156157
const protocol = https ? 'https' : 'http';
157-
const baseUrl = `${protocol}://localhost:${port}`;
158+
const baseUrl = `${protocol}://${host}:${port}`;
158159

159160
if (!targets.length) {
160161
if (routes.length) {

0 commit comments

Comments
 (0)