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

fix(glob): server perf when globbing huge dirs #9425

Merged
merged 1 commit into from Jul 29, 2022
Merged

fix(glob): server perf when globbing huge dirs #9425

merged 1 commit into from Jul 29, 2022

Conversation

tony19
Copy link
Contributor

@tony19 tony19 commented Jul 29, 2022

The vite:import-glob plugin was unnecessarily watching globbed files (and doing so without checking for duplicates). This causes significant overhead when the file list is large (2K or more). It's also redundant to watch the files because createServer() already recursively watches the project's root directory.

fixes #9391

Description

Additional context

I'd submit a unit test for this, but not yet sure how. The test-serve command is flaky on my machine (even without any of my changes).


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

This removes the file watchers in the vite:import-glob plugin, as that's
already done in createServer().

fixes #9391
@antfu
Copy link
Member

antfu commented Jul 29, 2022

I guess that makes sense. If a globbed file been imported, it should already been aware by the dev server so yeah probably this is redundant.

@patak-dev patak-dev merged commit 156a3a4 into vitejs:main Jul 29, 2022
@tony19 tony19 deleted the fix/server-perf-globbing-huge-dirs branch July 29, 2022 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dev server crawling dynamic imports on MacOS
4 participants