You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the Vite 4.4.0 branch/4.4.0-beta.0 release and setting the --host option the shortcut to open the browser with 'o' does not work and returns the following message instead: No URL available to open in browser
VITE v4.4.0-beta.0 ready in 664 ms
➜ Network: http://192.168.0.100:5173/
➜ press h to show help
No URL available to open in browser
The same message occurs if the "open" option is used to attempt to open a browser automatically on startup.
It appears this issue started to occur after this commit and the issue goes away if reverted: 505f0b9
This issue seems to occur because when a --host is specified we no longer have a "local" address in the "resolvedUrls" used here:
Perhaps simply looking at the "network" addresses for a resolvedUrl if the "local" list is empty is all that is needed: const url = server.resolvedUrls?.local[0] ?? server.resolvedUrls?.network[0]
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Perhaps simply looking at the "network" addresses for a resolvedUrl if the "local" list is empty is all that is needed: const url = server.resolvedUrls?.local[0] ?? server.resolvedUrls?.network[0]
Describe the bug
When using the Vite 4.4.0 branch/4.4.0-beta.0 release and setting the --host option the shortcut to open the browser with 'o' does not work and returns the following message instead:
No URL available to open in browser
The same message occurs if the "open" option is used to attempt to open a browser automatically on startup.
It appears this issue started to occur after this commit and the issue goes away if reverted: 505f0b9
This issue seems to occur because when a --host is specified we no longer have a "local" address in the "resolvedUrls" used here:
vite/packages/vite/src/node/server/index.ts
Line 438 in 1a0c806
Perhaps simply looking at the "network" addresses for a resolvedUrl if the "local" list is empty is all that is needed:
const url = server.resolvedUrls?.local[0] ?? server.resolvedUrls?.network[0]
Reproduction
https://stackblitz.com/edit/vitejs-vite-ccink3?file=package.json&terminal=dev
Steps to reproduce
A minimal example has been included. T
o trigger the issue simply:
--host 192.168.0.100
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: