Skip to content

Commit

Permalink
fix: cacheDir should be watch-ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Sep 25, 2022
1 parent 71eaacf commit 536cdb8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/vite/src/node/build.ts
Expand Up @@ -574,6 +574,7 @@ async function doBuild(
}

const resolvedChokidarOptions = resolveChokidarOptions(
config,
config.build.watch.chokidar
)

Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/server/index.ts
Expand Up @@ -304,7 +304,7 @@ export async function createServer(
const httpsOptions = await resolveHttpsConfig(config.server.https)
const { middlewareMode } = serverConfig

const resolvedWatchOptions = resolveChokidarOptions({
const resolvedWatchOptions = resolveChokidarOptions(config, {
disableGlobbing: true,
...serverConfig.watch
})
Expand Down
3 changes: 3 additions & 0 deletions packages/vite/src/node/watch.ts
@@ -1,6 +1,8 @@
import type { WatchOptions } from 'dep-types/chokidar'
import type { ResolvedConfig } from '.'

export function resolveChokidarOptions(
config: ResolvedConfig,
options: WatchOptions | undefined
): WatchOptions {
const { ignored = [], ...otherOptions } = options ?? {}
Expand All @@ -10,6 +12,7 @@ export function resolveChokidarOptions(
'**/.git/**',
'**/node_modules/**',
'**/test-results/**', // Playwright
config.cacheDir + '/**',
...(Array.isArray(ignored) ? ignored : [ignored])
],
ignoreInitial: true,
Expand Down

0 comments on commit 536cdb8

Please sign in to comment.