Look for new file and file deletion
NicolaSpadari opened this issue · comments
I run this plugin in vite + vue 3, with vite-plugin-pages.
I need to watch for changes under the src/pages
folder, when a file is created or deleted the server needs to restart, since the other plugins throws an error if i navigate to the page and the server wasn't restarted.
Can't seem to observe the files in a folder with this plugin.
No support or I just don't undestand how?
Yeah, we only listen to change
at this moment
vite-plugin-restart/src/index.ts
Line 100 in d8d5b9d
PR welcome, thanks!
ohh~~ this is what I need also, and I am now working on it... but it seems that I have met a problem:
how can I control the whole vite server to restart ? ( instead of just the vite websocket server, because I know there is a way to restart the vite websocket server, using ViteDevServer.close()
or ViteDevServer.listen()
, but if do so, only the websocket server will restart, not the whole vite server )
the reason why I try to restart the whole vite server is that I want to reload the Vite Plugins.... lol
For some reason I'm not being able to filter files in a folder using glob patterns, so I ended up doing some "manual" controls just passing the name of the folder under /src
Anyway, this is my small custom plugin for restarting the server when a file under the /pages
folder changes: link
For some reason I'm not being able to filter files in a folder using glob patterns, so I ended up doing some "manual" controls just passing the name of the folder under
/src
Anyway, this is my small custom plugin for restarting the server when a file under the/pages
folder changes: link
bro, thanks for your plugin though, but as the code shows, you are using server.ws.send({ type: "full-reload" })
, which it can only reload the pages instead of reload the vite entity..... so I think this might not be a true reload ?