Skip to content

Commit

Permalink
fix: server and preview open fails to add slash before relative path (v…
Browse files Browse the repository at this point in the history
  • Loading branch information
y1d7ng authored and futurGH committed Feb 26, 2023
1 parent 9468492 commit 5620b63
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/vite/src/node/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export async function preview(
openBrowser(
path.startsWith('http')
? path
: `${protocol}://${hostname.name}:${serverPort}${path}`,
: new URL(path, `${protocol}://${hostname.name}:${serverPort}`).href,
true,
logger,
)
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ async function startServer(
openBrowser(
path.startsWith('http')
? path
: `${protocol}://${hostname.name}:${serverPort}${path}`,
: new URL(path, `${protocol}://${hostname.name}:${serverPort}`).href,
true,
server.config.logger,
)
Expand Down

0 comments on commit 5620b63

Please sign in to comment.