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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ssrBuild flag in config env #8863

merged 7 commits into from Jul 3, 2022


Copy link

@patak-dev patak-dev commented Jun 30, 2022

Fixes #8835


Adds a flag to apply conditional configuration depending on SSR build. This doesn't apply for SSR dev, as the config is shared for it.

Should we pass the value of instead, so the user can also config depending on the SSR entry?
Edit: Blu said yes, it is now implemented as string | boolean 馃憤馃徏

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Copy link

netlify bot commented Jun 30, 2022

Deploy Preview for vite-docs-main ready!

Name Link
馃敤 Latest commit 15b264b
馃攳 Latest deploy log
馃槑 Deploy Preview
馃摫 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@patak-dev patak-dev added the p3-significant 馃敤 High priority enhancement (priority) label Jun 30, 2022
bluwy previously approved these changes Jun 30, 2022
Copy link
Member Author

patak-dev commented Jul 1, 2022

Alternative for the API, defineConfig could receive a PartiallyResolvedConfig as the env. So instead of ssrBuild, it will be:

export default defineConfig(({ command, mode, build: { ssr }}) => {
  // ...

The issue that I see is that people without TS may be confused by using build as a flag as:
build ? ... : ..., or be confused if they use ssr alone which may seem to imply is also true for dev SSR.

So I prefer we keep the current ssrBuild API and a flat env.

Copy link
Member Author

Modified the PR so ssrBuild is boolean only as decided in the last team meeting.

@patak-dev patak-dev added this to the 3.0 milestone Jul 2, 2022
docs/config/ Outdated Show resolved Hide resolved
docs/config/ Outdated Show resolved Hide resolved
Co-authored-by: Bjorn Lu <>
docs/config/ Outdated Show resolved Hide resolved
@patak-dev patak-dev merged commit b6d655a into main Jul 3, 2022
@patak-dev patak-dev deleted the feat/ssr-build-in-config-env branch July 3, 2022 06:37
Copy link
Member Author

There seems to be little usage for this feature. We opened a discussion to check if we should stabilize or deprecate it in Vite 5:

Are you currently using this feature @Kingdutch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
p3-significant 馃敤 High priority enhancement (priority)
Archived in project

Successfully merging this pull request may close these issues.

Provide SSR mode in conditional config
2 participants