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

Vite starts watcher, even if --watch is false #2467

Closed
6 tasks done
sheremet-va opened this issue Dec 8, 2022 · 1 comment · Fixed by #2680
Closed
6 tasks done

Vite starts watcher, even if --watch is false #2467

sheremet-va opened this issue Dec 8, 2022 · 1 comment · Fixed by #2680

Comments

@sheremet-va
Copy link
Member

sheremet-va commented Dec 8, 2022

Describe the bug

When Vitest starts in run mode, watcher is initiated and later stopped. In this time watcher can start watching a lot of files.

We should probably not even initiate chokidar watcher. To do this, we need to pass down watch: { ignored: ['*'] } to createServer.

There is a problem that watch and run flags can be configured inside vite.config, which is resolved after createServer call. We should disable this, and allow --watch and --run to be configured only as CLI flags. This way we can determine watch mode before calling createServer. This would be a breaking change.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-q5uxuk?file=README.md&initialPath=__vitest__

Used Package Manager

pnpm

Validations

@silverwind
Copy link
Contributor

There is a problem that watch and run flags can be configured inside vite.config, which is resolved after createServer call.

Having these flags in the config is convenient though as I can just npx vite and have it not watch. Can the config be parsed first? Generally I'd say parsing config is the first thing a application should do.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 7, 2023
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.

2 participants