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

Create only a single Vite server even if browser mode is enabled #6912

Open
6 tasks done
sheremet-va opened this issue Nov 15, 2024 · 0 comments
Open
6 tasks done

Create only a single Vite server even if browser mode is enabled #6912

sheremet-va opened this issue Nov 15, 2024 · 0 comments
Labels
p3-significant High priority enhancement (priority)
Milestone

Comments

@sheremet-va
Copy link
Member

sheremet-va commented Nov 15, 2024

Describe the bug

Currently, we need to create a server for every workspace project to resolve the config and have access to the module graph for project.vitenode/project.runner properties.

When the browser mode is enabled, we need a separate Vite server because it shouldn't share the same plugin that the project has and needs special additional handling. We also don't want to mix module graphs of different environments.

image

To fix this, we need to make some changes.

  1. Remove poolMatchGlob - this makes it possible to run Node.js tests and browser tests in the same project (which is the main reason why we need separate servers). Recommend the workspace instead
  2. Remove environmentMatchGlob - the presence of this requires us to share the module graph between different environments. Recommend the workspace instead
  3. Allow inline workspace #6913 to make the migration easier

This would guarantee that a single project is responsible for a single environment. With Vite 6, we can even migrate it to inline Vite environments.

Possible problems:

  1. --project filter is applied after all projects are resolved. Ideally, we should have a separation between config resolution and server creation, but Vite currently doesn't allow it (environment API allows it though)
  2. --project filter can be changed dynamically in watch mode. To support this, we would have to keep the configs around, but also close the filtered projects, - a lot of moving parts there. I am not sure it's justifyable to keep this feature.
  3. How does inline workspace look like? What if there is a workspace file? Does it override it?

Reproduction

https://github.com/vitest-dev/vitest/tree/main/examples/lit

System Info

Any

Used Package Manager

npm

Validations

@sheremet-va sheremet-va added the p3-significant High priority enhancement (priority) label Nov 15, 2024
@sheremet-va sheremet-va added this to the 2.2.0 milestone Nov 15, 2024
@sheremet-va sheremet-va moved this to P2 - 5 in Team Board Nov 15, 2024
@sheremet-va sheremet-va removed this from the 2.2.0 milestone Nov 15, 2024
@sheremet-va sheremet-va added this to the 3.0.0 milestone Nov 21, 2024
@sheremet-va sheremet-va moved this from P2 - 5 to Approved in Team Board Nov 21, 2024
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
Status: Approved
Development

No branches or pull requests

1 participant