File tree 4 files changed +13
-6
lines changed
4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -620,6 +620,7 @@ async function doBuild(
620
620
config . logger . info ( colors . cyan ( `\nwatching for file changes...` ) )
621
621
622
622
const resolvedChokidarOptions = resolveChokidarOptions (
623
+ config ,
623
624
config . build . watch . chokidar
624
625
)
625
626
Original file line number Diff line number Diff line change @@ -530,11 +530,13 @@ export async function resolveConfig(
530
530
531
531
// resolve cache directory
532
532
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
+ )
538
540
539
541
const assetsFilter =
540
542
config . assetsInclude &&
Original file line number Diff line number Diff line change @@ -315,7 +315,7 @@ export async function createServer(
315
315
const httpsOptions = await resolveHttpsConfig ( config . server . https )
316
316
const { middlewareMode } = serverConfig
317
317
318
- const resolvedWatchOptions = resolveChokidarOptions ( {
318
+ const resolvedWatchOptions = resolveChokidarOptions ( config , {
319
319
disableGlobbing : true ,
320
320
...serverConfig . watch
321
321
} )
Original file line number Diff line number Diff line change
1
+ import { escapePath } from 'fast-glob'
1
2
import type { WatchOptions } from 'dep-types/chokidar'
3
+ import type { ResolvedConfig } from '.'
2
4
3
5
export function resolveChokidarOptions (
6
+ config : ResolvedConfig ,
4
7
options : WatchOptions | undefined
5
8
) : WatchOptions {
6
9
const { ignored = [ ] , ...otherOptions } = options ?? { }
@@ -10,6 +13,7 @@ export function resolveChokidarOptions(
10
13
'**/.git/**' ,
11
14
'**/node_modules/**' ,
12
15
'**/test-results/**' , // Playwright
16
+ escapePath ( config . cacheDir ) + '/**' ,
13
17
...( Array . isArray ( ignored ) ? ignored : [ ignored ] )
14
18
] ,
15
19
ignoreInitial : true ,
You can’t perform that action at this time.
0 commit comments