antfu / vite-plugin-restart

Custom files/globs to restart Vite server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Globbing is incorrect for Windows style paths

alesvaupotic opened this issue · comments

On Win10, with project in

C:\Users\ales\code\_templates_\svelte-vite-windi

and ​config of

restart: ["windi.config.cjs"],

restartGlobs is set to

[​"C:\\Users\\ales\\code\\_templates_\\svelte-vite-windi/C:/Users/ales/code/_templates_/svelte-vite-windi/windi.config.cjs"]

and file change recognition is not working.

What works for me is replacing posix.resolve with

restartGlobs = toArray(options.restart).map((i2) => i2.replace(/\\/g, "/"));

There probably is a more robust solution than that, I am just trying to pinpoint the culprits.

Would you mind sending a quick PR? Thanks!

Sure, let me sort out a working solution for both systems and get back here.

Just seen your response on the lock file, I see you did it yourself and merged already. Thanks, appreciate the quick turnaround.