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

Provide SSR mode in conditional config #8835

Closed
4 tasks done
Kingdutch opened this issue Jun 28, 2022 · 3 comments · Fixed by #8863
Closed
4 tasks done

Provide SSR mode in conditional config #8835

Kingdutch opened this issue Jun 28, 2022 · 3 comments · Fixed by #8863

Comments

@Kingdutch
Copy link

Description

As a developer I want to be able to adjust my Vite config based on whether I'm building the client bundle or the SSR bundle.

Suggested solution

Extend the conditional config to also provide the SSR mode (the documentation currently encourages to set this as a command line flag so the info should be available at config build time?)

Alternative

No response

Additional context

No response

Validations

@bluwy
Copy link
Member

bluwy commented Jun 28, 2022

The SSR config is currently shared with the main config as they can work together. Can you show a usecase where this feature is needed?

@Kingdutch
Copy link
Author

One use-case was to make it easier to work around e.g. #8836

Vite SSR causes vite build to be run twice for two different purposes. There's currently no good way to discern between the two when building a config, adding the ssr flag would help.

Another scenario can be seen internally in Vite 2 where the inlineDynamicImports was set to TRUE only for SSR builds. Users of Vite may want to make similar configuration changes or perhaps change the plugins that they run (e.g. run some plugin only for SSR or only for the client bundle).

@patak-dev
Copy link
Member

We discussed at one point in a team meeting about this option, PR implementing it here:

@github-actions github-actions bot locked and limited conversation to collaborators Jul 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants