Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"serve" command not listed #16117

Closed
1 of 4 tasks
dandv opened this issue Mar 7, 2024 · 3 comments · Fixed by #16145
Closed
1 of 4 tasks

"serve" command not listed #16117

dandv opened this issue Mar 7, 2024 · 3 comments · Fixed by #16145
Labels
documentation Improvements or additions to documentation

Comments

@dandv
Copy link

dandv commented Mar 7, 2024

Documentation is

  • Missing
  • Outdated
  • Confusing
  • Not sure?

Explain in Detail

https://vitejs.dev/config/#conditional-config mentions "If the config needs to conditionally determine options based on the command (serve or build)", but serve is not listed at https://vitejs.dev/guide/cli.html

Your Suggestion for Changes

List serve at https://vitejs.dev/guide/cli.html

Reproduction

No response

Steps to reproduce

No response

@dandv dandv added the documentation Improvements or additions to documentation label Mar 7, 2024
@sapphi-red
Copy link
Member

It is important to note that in Vite's API the command value is serve during dev (in the cli vite, vite dev, and vite serve are aliases), and build when building for production (vite build).
https://vitejs.dev/config/#conditional-config:~:text=It%20is%20important%20to%20note%20that%20in%20Vite%27s%20API%20the%20command%20value%20is%20serve%20during%20dev%20(in%20the%20cli%20vite%2C%20vite%20dev%2C%20and%20vite%20serve%20are%20aliases)%2C%20and%20build%20when%20building%20for%20production%20(vite%20build).

There's a explanation of this just below. I agree it's confusing. Ideally, it'd be nice to rename serve to dev, but that's a breaking change and we want to avoid that. Do you have any ideas on how to improve this?

@dandv
Copy link
Author

dandv commented Mar 10, 2024

Do you have any ideas on how to improve this?

Since dev is not mentioned either, how about changing "https://vitejs.dev/guide/cli.html" to start with,

Start Vite dev server in the current directory. vite dev and vite serve are aliases for vite, maintained for backwards compatibility.

@bluwy
Copy link
Member

bluwy commented Mar 11, 2024

Updating the CLI page sounds fine to me, but I'd remove the maintained for backwards compatibility part. I don't think it's worth the breaking change to remove it in the future (as the wording seems to imply that).

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants