From fa0e48c8df8f66fb76f7df4d7d662a5c7b3c3c7c Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Wed, 29 Jul 2026 18:11:48 +0530 Subject: [PATCH] fix(build): don't apply docsearch css transform to pages matching its filter A markdown or Vue file whose path contains the word "docsearch" was intercepted by the @docsearch/css transform and never compiled, failing the build. Check page extensions first. Co-Authored-By: Claude Fable 5 --- src/node/plugin.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/node/plugin.ts b/src/node/plugin.ts index cdcd00c7..4711df99 100644 --- a/src/node/plugin.ts +++ b/src/node/plugin.ts @@ -208,12 +208,6 @@ export async function createVitePressPlugin( transform: { filter: { id: [docsearchRE, /\.vue$/, /\.md$/] }, async handler(code, id) { - if (docsearchRE.test(normalizePath(id))) { - return code - .replaceAll('[data-theme=dark]', '.dark') - .replaceAll(/\(max-width:\s*768px\)/g, '(max-width: 767px)') - .replaceAll(/\(min-width:\s*769px\)/g, '(min-width: 768px)') - } if (id.endsWith('.vue')) { return processClientJS(code, id) } @@ -254,6 +248,12 @@ export async function createVitePressPlugin( } return processClientJS(vueSrc, id) } + if (docsearchRE.test(normalizePath(id))) { + return code + .replaceAll('[data-theme=dark]', '.dark') + .replaceAll(/\(max-width:\s*768px\)/g, '(max-width: 767px)') + .replaceAll(/\(min-width:\s*769px\)/g, '(min-width: 768px)') + } } },