-
-
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 isPreview to ConfigEnv and resolveConfig #14855
Conversation
Run & review this pull request in StackBlitz Codeflow. |
For reference, we also use |
Yeah I also find the |
Before merging, make sure to set the co-author!
|
Very neat. (I've used many ugly hacks in the past to workaround this.)
No need to :) |
packages/vite/src/node/config.ts
Outdated
/** | ||
* @experimental | ||
*/ | ||
ssrBuild?: boolean | ||
isSsrBuild: boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the plan for avoiding #8912? (https://discord.com/channels/804011606160703521/831456449632534538/993429210867707914)
For example, are we going to say "call loadConfigFromFile
for each build separately"?
Otherwise, I guess vitepress won't be able to pass the correct value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea I'm thinking is that, if you don't know or can't be sure what it is, you can simply set false
(we do the same for vitestSetup.ts
in this PR). Maybe it makes more sense to allow undefined
to convey the "i don't know part"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed a commit that makes them undefined
-able
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking we could keep a ssrBuild
getter with a warning to guide folks in the transition, but given the feature is rarely used I think we could merge this one with out that.
Description
Add
isPreview
toConfigEnv
. Supersedes #12298I made a very direct breaking change to
ssrBuild
(renamed toisSsrBuild
) and we could decide if it's a good idea or not 😬This will break
loadConfigForFile
mostly and its first parameter accepts aConfigEnv
. However, I don't think it's hard to fix it.Additional context
ssrBuild
: Stabilizing `ConfigEnv` `ssrBuild` #13809As the discussion mentioned,
ssrBuild
is not widely used.What is the purpose of this pull request?