Every file on PC is watched with dev server when using inline CSS on html page whose path
is /
#7615
Closed
7 tasks done
Labels
Describe the bug
I came across this issue from using
vite-plugin-ssr
, however I think it is an issue with Vite itself so I've put the issue here.I've spent a little while looking around the code to try to see what the issue is:
It seems to be triggered by the changes in #7262 - this change makes inline CSS become a script pointed at
[path]?html-proxy&...
, which usually would get resolved to the full path to that HTML file (e.g./index.html?html-proxy&...
->/home/alduino/.../index.html?html-proxy&...
), but when the path is/
, it doesn't get resolved to anything (it stays as a URL path) (seeensureEntryFromUrl
), so the watcher that is added here will recursively go down every directory and watch it. In my case (and how I found out about the issue), it causes the build to hang for a few seconds and then crash because it tried to resolve/run/udev/watch/1
which is a broken symlink.This seems to happen with other paths that exist as root directories too - testing with
/home
makes the build very slow, and with/run
Vite crashes with the symlink error. It also crashes if I create an invalid symlink at/run.html/test
and then try to load a route at/run.html
(So it seems Vite's file resolution is based on if it actually exists or not, as therun.html
route wasn't from a real file)Interstingly, at
/
, I get the errorFailed to resolve entry for package /path/to/vite-reprod-eloop
ifmain
is not set (or if it is incorrect) in the package.json (and then if I set it, it crashes with the symlink error), but at/run
it just crashes even ifmain
is not set. I've also just tried pointing themain
at an empty Javascript file and this issue doesn't happen at all, which is weird.Reproduction
https://github.com/Alduino/vite-reprod-eloop
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: