Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cacheDir should be ignored from watch #10242

Merged
merged 4 commits into from Dec 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
4 changes: 4 additions & 0 deletions packages/vite/src/node/watch.ts
@@ -1,6 +1,9 @@
import path from 'node:path'
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 +13,7 @@ export function resolveChokidarOptions(
'**/.git/**',
'**/node_modules/**',
'**/test-results/**', // Playwright
path.relative(config.root, config.cacheDir + '/**'),
shigma marked this conversation as resolved.
Show resolved Hide resolved
...(Array.isArray(ignored) ? ignored : [ignored])
],
ignoreInitial: true,
Expand Down