vite-plugin-windicss icon indicating copy to clipboard operation
vite-plugin-windicss copied to clipboard

Plugin causes intermittent chokidar error in Vite watch mode on Windows

Open horsenit opened this issue 3 years ago • 1 comments

Describe the bug Occasionally, on Windows, while using this plugin Vite can exit with an error from chokidar (EBUSY, usually with a system file like DumpStack.log, hiberfil.sys, pagefile.sys, or swapfile.sys, so it likely has to be on the system drive)

Minimal Reproductions Using your WebExtension Vite Starter Template, https://github.com/antfu/vitesse-webext, pnpm run dev this crash will happen intermittently, but you can induce it by creating and deleting a new folder in the root of the drive (C:\ I guess)

Versions

  • vite-plugin-windicss: 1.5.4
  • vite: 2.6.2

Additonal Context This is because of packages/shared/virtual-module.ts, specifically MODULE_ID_VIRTUAL_PREFIX, this ends up adding a path like /@windicss/windi.css to rollup's FS watcher, which I guess makes chokidar start watching the root directory. Adding a \0 or ~ to the start of that variable resolves the issue, maybe the regex below it as well.

horsenit avatar Dec 17 '21 19:12 horsenit

Took me a while to find out this plugin was the cause of my problem. Used the same Starter Template and - surprise - same error :)

Adding your prefixes to the paths "solved" the problem. 👍 Would be nice to have it fixed permanently. Does the fix work on other platforms? (seems there was a related problem in https://github.com/underfin/vite-plugin-vue2/issues/24)

chartinger avatar May 18 '22 08:05 chartinger