lambda-packages icon indicating copy to clipboard operation
lambda-packages copied to clipboard

Refactor server url logs

Open bluwy opened this issue 3 years ago • 5 comments

Changes

Close #4315

Vite 3 has an experimental server.resolvedUrls property for the URLs Vite is serving from. It will be stabilize in 3.1 without any API change. https://github.com/vitejs/vite/pull/9866

This PR uses that for the dev server so we closely match the Vite dev server behaviour.

Before:

> astro dev

  🚀  astro  v1.1.1 started in 84ms
  
  ┃ Local    http://localhost:3000/
  ┃ Network  use --host to expose
> astro dev "--host"

  🚀  astro  v1.1.1 started in 78ms
  
  ┃ Local    http://localhost:3000/
  ┃ Network  http://192.168.0.165:3000/
> astro preview

  🚀  astro  v1.1.1 started in 2ms
  
  ┃ Local    http://localhost:3000/
  ┃ Network  use --host to expose

After:

> astro dev

  🚀  astro  v1.1.1 started in 82ms
  
  ┃ Local    http://127.0.0.1:3000/
  ┃ Network  use --host to expose
> astro dev "--host"

  🚀  astro  v1.1.1 started in 106ms
  
  ┃ Local    http://localhost:3000/
  ┃ Network  http://192.168.0.165:3000/
> astro preview

  🚀  astro  v1.1.1 started in 2ms
  
  ┃ Local    http://localhost:3000/
  ┃ Network  use --host to expose

NOTE that the http://127.0.0.1:3000/ change in astro dev after, without the --host option Vite (or Node specifically) would only serve under 127.0.0.1 (ipv4), [::1] (ipv6) isn't served, which could be covered by localhost.

Testing

Tested with the local examples.

Docs

N/A

bluwy avatar Aug 27 '22 05:08 bluwy