withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
45.85k stars 2.41k forks source link

unify preview server config #11289

Open oe opened 3 months ago

oe commented 3 months ago

Changes

Merge preview server config by:

const previewConfig = Object.assign({},
  settings.config.vite.server,
  settings.config.vite.preview,
  settings.config.server,
)

Make the preview server can access all server config from vite.server / vite.preview / server.

Especially, this make preview server access proxy settings from these objects which allow preview proxy api request just like dev server!

Testing

  1. add proxy config to astro.config.ts
  2. build your project
  3. run astro preview and check network

Docs

This PR adds new feature to astro preview, docs should be updated

changeset-bot[bot] commented 3 months ago

🦋 Changeset detected

Latest commit: 3feb8cd977d4f40266c06c8551c1da29f5ee5ba2

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

ematipico commented 3 months ago

This PR adds new feature to astro preview, docs should be updated

Developers are usually in charge of updating the docs. Could you send a PR to update the docs? Or at least, which docs should be updated?

oe commented 3 months ago

This PR adds new feature to astro preview, docs should be updated

Developers are usually in charge of updating the docs. Could you send a PR to update the docs? Or at least, which docs should be updated?

The Server Options may need update according to Vite Preview Options

florian-lefebvre commented 1 month ago

@oe are you still interested in this PR?

oe commented 1 month ago

@oe are you still interested in this PR?

Yes, what do I need to do?

florian-lefebvre commented 1 month ago

@bluwy do you have advices?