Closed srflp closed 1 year ago
Hello @srflp. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction
will be closed if they have no activity within 3 days.
@Niputi I provided the reproduction and figured out that the problem is simpler to reproduce than I thought (which means the problem is quite severe)
I can confirm that it breaks starting with vite-4.3.0-beta.3, 4.2.2 and 4.3.0-beta.2 don't have it.
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:
Create a
repro
folder, I created it in my home directory (~
or/home/my_username
).Enter this directory
Create a sample project in this directory
Enter the sample project folder
Install dependencies
Run vite dev server in debug mode, to see files which are observed via HMR:
In any browser, visit the page
http://localhost:5173/home
. Suspicious line appears in the terminal:This is definitely an invalid resolution but let's move on
In another terminal, enter the
~/repro
folderCreate a file in this folder
Modify this file:
(type in any characters and save using
:wq
)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
```shell vite:hmr [file change] /home/Validations