HMR in Vite 4.3.0-beta.3 (including 4.3.0) watches user's home folder instead of project files (in some particular case) #12926
Labels
feat: hmr
p4-important
Violate documented behavior or significantly improves performance (priority)
regression
The issue only appears after a new release
Describe the bug
Dev server in Vite 4.3.0-beta.3 (including 4.3.0), after typing in
/home
as an URI in the browser starts the HMR watcher on the whole user directory (~
or/home/<username>
).Our website by default opens
http://localhost:<port>/home
in the browser so it triggers the bug immediately.The bug does not appear in version 4.3.0-beta.2 and below and was introduced in 4.3.0-beta.3.
After effects: in bigger projects the dev server is unusably slow and crashes because of hundred thousands of watched files.
Reproduction
Follow the steps below.
Steps to reproduce
Using linux:
repro
folder, I created it in my home directory (~
or/home/my_username
).mkdir ~/repro
cd sample-project
http://localhost:5173/home
.Suspicious line appears in the terminal:
This is definitely an invalid resolution but let's move on
~/repro
folder(type in any characters and save using
:wq
)12. Voila
HMR reacted on this file change, even though the file isn't in the project directory (project directory is
~/repro/sample_project
)System Info
Used Package Manager
pnpm
Logs
The reality - hundreds of HMR reactions due to updated files in the user directory, which make vite unusable in big projects
Validations
The text was updated successfully, but these errors were encountered: