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

Prevent Vite watching on Astro config load #7171

Merged
merged 2 commits into from May 23, 2023
Merged

Prevent Vite watching on Astro config load #7171

merged 2 commits into from May 23, 2023

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented May 23, 2023

Changes

From @ematipico's suggestion #7073 (comment), we could prevent Vite watching when spinning up the Vite dev server.

It looks like the watching is already disabled for content collections / astro sync via:

ignored: mode === 'build' ? ['**'] : undefined,

But I updated the Astro config load flow too as that will benefit from it.

Testing

Logged viteServer.watcher.getWatched() to verify that directories aren't watched.

Docs

n/a. internal improvement.

@changeset-bot
Copy link

changeset-bot bot commented May 23, 2023

🦋 Changeset detected

Latest commit: f2b0a44

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label May 23, 2023
server: { middlewareMode: true, hmr: false },
server: { middlewareMode: true, hmr: false, watch: { ignored: ['**/*'] } },
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As explained in the PR description, this isn't needed, but I updated anyways so it's consistent with the createViteLoader code.

@bluwy bluwy merged commit 79ba748 into main May 23, 2023
1 check passed
@bluwy bluwy deleted the astro-watch-vite branch May 23, 2023 14:40
@astrobot-houston astrobot-houston mentioned this pull request May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants