From 59d1ca8ca57c5d01433b6083778eb70b1a175f18 Mon Sep 17 00:00:00 2001 From: nblog <503407184@qq.com> Date: Fri, 19 Jun 2026 20:42:14 +0800 Subject: [PATCH] fix(vite-plugin-webmcp): normalize Windows path for include matching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🔧 - Generated by Copilot --- packages/vite-plugin-webmcp/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/vite-plugin-webmcp/src/index.ts b/packages/vite-plugin-webmcp/src/index.ts index bb1e9b4..aab728b 100644 --- a/packages/vite-plugin-webmcp/src/index.ts +++ b/packages/vite-plugin-webmcp/src/index.ts @@ -57,7 +57,8 @@ export function vitePluginWebMcp(options: WebMcpPluginOptions = {}): Plugin { if (!/\.[jt]sx?$/.test(cleanId)) return null; // include 匹配检查 - const relativePath = nodePath.relative(projectRoot, cleanId); + // 统一使用正斜杠,避免 Windows 反斜杠导致 glob 匹配失败 + const relativePath = nodePath.relative(projectRoot, cleanId).replace(/\\/g, '/'); const isIncluded = include.some(pattern => { const regex = new RegExp( '^' +