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( '^' +