Skip to content

Commit

Permalink
feat: server.open supports absolute path (#5068)
Browse files Browse the repository at this point in the history
  • Loading branch information
HelKyle committed Sep 24, 2021
1 parent 60b6f55 commit 2d6f682
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
Expand Up @@ -74,7 +74,7 @@ export async function preview(
if (options.open) {
const path = typeof options.open === 'string' ? options.open : base
openBrowser(
`${protocol}://${hostname.name}:${serverPort}${path}`,
path.startsWith('http') ? path : `${protocol}://${hostname.name}:${serverPort}${path}`,
true,
logger
)
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/server/index.ts
Expand Up @@ -641,7 +641,7 @@ async function startServer(
if (options.open && !isRestart) {
const path = typeof options.open === 'string' ? options.open : base
openBrowser(
`${protocol}://${hostname.name}:${serverPort}${path}`,
path.startsWith('http') ? path : `${protocol}://${hostname.name}:${serverPort}${path}`,
true,
server.config.logger
)
Expand Down

0 comments on commit 2d6f682

Please sign in to comment.