-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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 forces refresh on ANY file change when negative glob paths are used #13374
Comments
Start a new pull request in StackBlitz Codeflow. |
After I tried the reproduction, vite dev server refreshed when adding, removing and renaming files. But it wouldn't refresh when the file content was edited. |
You're right, i've checked and indeed it refreshes when any file is created, removed or moved. But not when changing the contents of this file. |
Not sure whether this is a valid bug. When you use |
Yes, if it was solely However if you combine it with an inclusive glob But internally it does watch every single file in the root and refreshes like you describe, which is not really expected when using it as described in https://vitejs.dev/guide/features.html#negative-patterns |
Describe the bug
After using the following piece of code
to automatically import vue files and lazy load them if it contains lazy in the file name we noticed Vite would refresh the page when ANY files are created, removed or moved.
In this case the file containing this code would be in
/resources/js/
and Vite would respond to changes in/storage/cache/
Removing the line
!./components/*.lazy.vue
from the code fixes the issueReproduction
https://stackblitz.com/edit/vitejs-vite-7jm5s1?file=main.js,components%2Ftest.lazy.vue,shouldntrefreshbecauseofthis&terminal=dev
Steps to reproduce
Add any relative negative glob import to your file (having a positive glob in there as well to really push the point home)
run
yarn/npm run dev
add/remove/rename any file in the root folder of your project (where your vite config lives)
Check the terminal to see vite forcing a refresh due to a file change
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: