From cc47178806936cbcc98b246b3989b2073c1d8f6a Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Fri, 22 Jul 2022 01:57:54 +1000 Subject: [PATCH] fix: normalise windows paths (#7) * normalise paths to support windows paths * chore: differentiate type imports Co-authored-by: Maximo Mussini --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 56b5d06..ce2d6be 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ import { resolve, relative } from 'path' import colors from 'picocolors' import picomatch from 'picomatch' -import type { PluginOption, ViteDevServer } from 'vite' +import { normalizePath, type PluginOption, type ViteDevServer } from 'vite' /** * Configuration for the watched paths. @@ -46,7 +46,7 @@ export default (paths: string | string[], config: Config = {}): PluginOption => configureServer ({ watcher, ws, config: { logger } }: ViteDevServer) { const { root = process.cwd(), log = true, always = true, delay = 0 } = config - const files = Array.from(paths).map(path => resolve(root, path)) + const files = Array.from(paths).map(path => resolve(root, path)).map(normalizePath) const shouldReload = picomatch(files) const checkReload = (path: string) => { if (shouldReload(path)) {