-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
feat: add config.operation #12298
feat: add config.operation #12298
Conversation
Run & review this pull request in StackBlitz Codeflow. |
It's really a shame we can't call this |
Yes, I couldn't agree more.
👍 Done.
I think so too. How about we already start showing a warning in the next patch release? |
I noticed that this change is a breaking change as it requires users to pass an additional argument to |
We discussed about this in the meeting today. To minimize the changes, and since the main usecase is to only differentiate dev and preview, we think passing a This would make it work similar to the |
Neat, good idea. I'll try to update the PR later today. |
Neat. No need for credits. |
Description
This is solving a long standing problem: there isn't a reliable way to distinguish between
dev
andpreview
(sinceconfig.command === 'serve'
for both$ vite dev
and$ vite preview
).There are workarounds but none of them are reliable. (E.g. checking whether
configureServer()
/configurePreviewServer()
is called doesn't work in certain situations.)What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).Ideally, include relevant tests that fail without this PR but pass with it.N/A.