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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ssrBuild flag in config env #8863

Merged
merged 7 commits into from
Jul 3, 2022
Merged

Conversation

patak-dev
Copy link
Member

@patak-dev patak-dev 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

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-dev patak-dev added the p3-significant High priority enhancement (priority) label Jun 30, 2022
bluwy
bluwy previously approved these changes Jun 30, 2022
@patak-dev
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.

@patak-dev
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/index.md Outdated Show resolved Hide resolved
docs/config/index.md Outdated Show resolved Hide resolved
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
docs/config/index.md 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
@patak-dev
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
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