Skip to content

Commit

Permalink
fix: server and preview open fails to add slash before relative path (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
y1d7ng authored Dec 17, 2022
1 parent 2059319 commit 57276b7
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 57276b7

Please sign in to comment.