Skip to content

feat: ssrBuild flag in config env#8863

Merged
patak-cat merged 7 commits intomainfrom
feat/ssr-build-in-config-env
Jul 3, 2022
Merged

feat: ssrBuild flag in config env#8863
patak-cat merged 7 commits intomainfrom
feat/ssr-build-in-config-env

Conversation

@patak-cat
Copy link
Copy Markdown
Member

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

Fixes #8835

Description

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 config.build.ssr 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

@netlify
Copy link
Copy Markdown

netlify bot commented Jun 30, 2022

Deploy Preview for vite-docs-main ready!

Name Link
🔨 Latest commit 15b264b
🔍 Latest deploy log https://app.netlify.com/sites/vite-docs-main/deploys/62c125aa5b24960008c33334
😎 Deploy Preview https://deploy-preview-8863--vite-docs-main.netlify.app
📱 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-cat patak-cat added the p3-significant High priority enhancement (priority) label Jun 30, 2022
bluwy
bluwy previously approved these changes Jun 30, 2022
@patak-cat
Copy link
Copy Markdown
Member Author

patak-cat 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.

@patak-cat
Copy link
Copy Markdown
Member Author

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

@patak-cat patak-cat added this to the 3.0 milestone Jul 2, 2022
Co-authored-by: Bjorn Lu <[email protected]>
@patak-cat patak-cat merged commit b6d655a into main Jul 3, 2022
@patak-cat patak-cat deleted the feat/ssr-build-in-config-env branch July 3, 2022 06:37
@patak-cat
Copy link
Copy Markdown
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

Labels

p3-significant High priority enhancement (priority)

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Provide SSR mode in conditional config

2 participants