diff --git a/plugins/plugin-search/src/node/searchPlugin.ts b/plugins/plugin-search/src/node/searchPlugin.ts index 14b9ce99..4a1b483a 100644 --- a/plugins/plugin-search/src/node/searchPlugin.ts +++ b/plugins/plugin-search/src/node/searchPlugin.ts @@ -35,9 +35,10 @@ export function searchPlugin({ onPrepared: app => prepareSearchIndex({ app, isSearchable, searchOptions }), onWatched: (app, watchers) => { - const searchIndexWatcher = chokidar.watch('pages/**/*.js', { + const searchIndexWatcher = chokidar.watch('pages', { cwd: app.dir.temp(), ignoreInitial: true, + ignored: (filepath, stats) => Boolean(stats?.isFile()) && !filepath.endsWith('.js'), }) searchIndexWatcher.on('add', (filepath) => { onSearchIndexUpdated(filepath, { app, isSearchable, searchOptions }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5c9893e2..1144799a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -201,8 +201,8 @@ catalogs: specifier: ^4.5.0 version: 4.5.0 chokidar: - specifier: 3.6.0 - version: 3.6.0 + specifier: 4.0.3 + version: 4.0.3 create-filter: specifier: ^1.1.0 version: 1.1.0 @@ -628,7 +628,7 @@ importers: version: 13.3.0(vue@3.5.17(typescript@5.8.3)) chokidar: specifier: catalog:prod - version: 3.6.0 + version: 4.0.3 esbuild: specifier: ^0.25.5 version: 0.25.5 @@ -728,7 +728,7 @@ importers: version: 13.3.0(axios@1.8.3)(focus-trap@7.6.5)(vue@3.5.17(typescript@5.8.3)) chokidar: specifier: catalog:prod - version: 3.6.0 + version: 4.0.3 focus-trap: specifier: catalog:prod version: 7.6.5 @@ -830,7 +830,7 @@ importers: version: 7.1.0 chokidar: specifier: catalog:prod - version: 3.6.0 + version: 4.0.3 create-filter: specifier: catalog:prod version: 1.1.0 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index d7e2de38..0743bfc8 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -82,7 +82,7 @@ catalogs: bcrypt-ts: ^7.1.0 cac: ^6.7.14 chart.js: ^4.5.0 - chokidar: 3.6.0 + chokidar: 4.0.3 create-filter: ^1.1.0 dayjs: ^1.11.13 echarts: ^5.6.0 diff --git a/theme/src/node/autoFrontmatter/generator.ts b/theme/src/node/autoFrontmatter/generator.ts index a785c386..2f642ddc 100644 --- a/theme/src/node/autoFrontmatter/generator.ts +++ b/theme/src/node/autoFrontmatter/generator.ts @@ -115,10 +115,16 @@ export async function watchAutoFrontmatter(app: App, watchers: any[]): Promise { + if (filepath.includes('node_modules')) + return true + if (filepath.includes('.vuepress')) + return true + return Boolean(stats?.isFile()) && !filepath.endsWith('.md') + }, }) watcher.on('add', async (relativePath) => { diff --git a/theme/src/node/prepare/index.ts b/theme/src/node/prepare/index.ts index 757448c8..a0ef4a27 100644 --- a/theme/src/node/prepare/index.ts +++ b/theme/src/node/prepare/index.ts @@ -25,9 +25,10 @@ export function watchPrepare( app: App, watchers: any[], ): void { - const pagesWatcher = watch('pages/**/*.js', { + const pagesWatcher = watch('pages', { cwd: app.dir.temp(), ignoreInitial: true, + ignored: (filepath, stats) => Boolean(stats?.isFile()) && !filepath.endsWith('.js'), }) watchers.push(pagesWatcher)