refactor!: serve command renamed to dev#5097
Conversation
|
I personally don't like
|
|
But I prefer |
|
I see that Astro is using As an aside, both Astro and SvelteKit use |
|
I like consistency and dev/build/preview for both script and command names makes sense. renaming vite serve to dev (both command and mode) would achieve this. keeping a serve alias around with a deprecation warning until vite3 |
|
Also I completely agree that the preview command should be explicitly documented as "do not use in production" and it transpires that message in the name itself. serve could be misunderstood as ok for production use |
Both The case for So for most users, yes, I think we only need to remind them of avoiding naming scripts as |
|
Closing in favor of #5207 |
Description
In the last team meeting we discussed renaming the
vite servecommand tovite dev.We currently have
It is confusing that
pnpm run servedoesn't callvite servebutvite preview.I think that
devlooks good here, but this PR is marked as a draft because I don't know if we can proceed with the renaming. For this change to make sense, we should not only rename the command but also change'serve'to'dev'in the plugin and javascript API of Vite. If not, it is going to be equally confusing. The problem is that I don't see a way to make this change backward compatible. Plugins are usingapply: 'serve'and are conditionally changing the config usingcommand === 'serve'. The ecosystem may still be small enough to go through with this (by coordinating with plugin authors), but I don't think this is really workable.I sent the PR anyways because it is easier to discuss by looking at the changeset.
In my opinion, we should leave
serveas is. Renamepnpm run devtopnm run serveand look for a different word forpnpm run {preview}. We can't use preview because of the pre/post scripts. Maybeshow,stage? It isn't easy to find a better word than preview. If we find another word we could rename also the command so we end up withWhat is the purpose of this pull request?