feat!: add isPreview to ConfigEnv and resolveConfig#14855
Conversation
|
|
|
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.
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.
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.
I've pushed a commit that makes them undefined-able
patak-cat
left a comment
There was a problem hiding this comment.
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
isPreviewtoConfigEnv. 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
loadConfigForFilemostly 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,
ssrBuildis not widely used.What is the purpose of this pull request?