File tree Expand file tree Collapse file tree 4 files changed +13
-6
lines changed
Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -620,6 +620,7 @@ async function doBuild(
620620 config . logger . info ( colors . cyan ( `\nwatching for file changes...` ) )
621621
622622 const resolvedChokidarOptions = resolveChokidarOptions (
623+ config ,
623624 config . build . watch . chokidar
624625 )
625626
Original file line number Diff line number Diff line change @@ -530,11 +530,13 @@ export async function resolveConfig(
530530
531531 // resolve cache directory
532532 const pkgPath = lookupFile ( resolvedRoot , [ `package.json` ] , { pathOnly : true } )
533- const cacheDir = config . cacheDir
534- ? path . resolve ( resolvedRoot , config . cacheDir )
535- : pkgPath
536- ? path . join ( path . dirname ( pkgPath ) , `node_modules/.vite` )
537- : path . join ( resolvedRoot , `.vite` )
533+ const cacheDir = normalizePath (
534+ config . cacheDir
535+ ? path . resolve ( resolvedRoot , config . cacheDir )
536+ : pkgPath
537+ ? path . join ( path . dirname ( pkgPath ) , `node_modules/.vite` )
538+ : path . join ( resolvedRoot , `.vite` )
539+ )
538540
539541 const assetsFilter =
540542 config . assetsInclude &&
Original file line number Diff line number Diff line change @@ -315,7 +315,7 @@ export async function createServer(
315315 const httpsOptions = await resolveHttpsConfig ( config . server . https )
316316 const { middlewareMode } = serverConfig
317317
318- const resolvedWatchOptions = resolveChokidarOptions ( {
318+ const resolvedWatchOptions = resolveChokidarOptions ( config , {
319319 disableGlobbing : true ,
320320 ...serverConfig . watch
321321 } )
Original file line number Diff line number Diff line change 1+ import { escapePath } from 'fast-glob'
12import type { WatchOptions } from 'dep-types/chokidar'
3+ import type { ResolvedConfig } from '.'
24
35export function resolveChokidarOptions (
6+ config : ResolvedConfig ,
47 options : WatchOptions | undefined
58) : WatchOptions {
69 const { ignored = [ ] , ...otherOptions } = options ?? { }
@@ -10,6 +13,7 @@ export function resolveChokidarOptions(
1013 '**/.git/**' ,
1114 '**/node_modules/**' ,
1215 '**/test-results/**' , // Playwright
16+ escapePath ( config . cacheDir ) + '/**' ,
1317 ...( Array . isArray ( ignored ) ? ignored : [ ignored ] )
1418 ] ,
1519 ignoreInitial : true ,
You can’t perform that action at this time.
0 commit comments