Closed myleshyson closed 3 years ago
I tried putting the vendor and storage directories in the server.watch.ignored option but that doesn't seem to do anything. Tested that by creating a small little plugin that logs the file triggering the hmr update in the handleHotUpdate hook.
I try to reproduce your problem with the following.
a dummy js
file : vendor/a.js
vite.config.js
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
// https://vitejs.dev/config/ export default defineConfig({ plugins: [ vue({}), vueJsx({}), { plugin: "vite:hmr-logger", handleHotUpdate(_) { console.log("file changed"); }, }, ], server: { watch: { ignored: ["/vendor/"], }, }, });
But when I mutated `vendor/a.js`, there wasn't any logs. @myleshyson
Huh well this is embarrassing, I guess I wasn't setting the paths properly. Was using ./storage
instead of **/storage/**
. Once I updated the paths it seemed like they were actually getting ignored.
I still think an allowlist is easier manage but this is working for me now.
Let's close this one, as the API already allows you to do this. We need to try to reduce the API surface. Thanks for the proposal.
Clear and concise description of the problem
This is related to issue 667, but i'm currently using vite in Craft CMS which includes a lot of folders that vite doesn't need to watch, including a storage folder with runtime log files. Those logs are updated constantly by the CMS via ajax requests, which in turn triggers an HMR update.
I tried putting the vendor and storage directories in the
server.watch.ignored
option but that doesn't seem to do anything. Tested that by creating a small little plugin that logs the file triggering the hmr update in thehandleHotUpdate
hook.Suggested solution
It would be nice for us PHP and other backend folks to have an option to scope the chokidar instance in vite to only watch files we specify to avoid having to account for various backend things like logs triggering an hmr update.