Skip to content

Commit

Permalink
fix: normalise windows paths (#7)
Browse files Browse the repository at this point in the history
* normalise paths to support windows paths

* chore: differentiate type imports

Co-authored-by: Maximo Mussini <maximomussini@gmail.com>
  • Loading branch information
timacdonald and ElMassimo authored Jul 21, 2022
1 parent 0899c13 commit cc47178
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit cc47178

Please sign in to comment.