From adb96cd6ee1d9acb6cddb6c9e30f421d2dba3e04 Mon Sep 17 00:00:00 2001 From: Jungzl <13jungzl@gmail.com> Date: Wed, 30 Oct 2024 14:27:52 +0800 Subject: [PATCH] docs: component preview not showing on Windows (#1401) --- docs/.vitepress/plugins/ComponentPreview.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/.vitepress/plugins/ComponentPreview.ts b/docs/.vitepress/plugins/ComponentPreview.ts index 87007b14e..286805cb3 100644 --- a/docs/.vitepress/plugins/ComponentPreview.ts +++ b/docs/.vitepress/plugins/ComponentPreview.ts @@ -49,6 +49,8 @@ export default function (md: MarkdownRenderer) { const { realPath, path: _path } = state.env as MarkdownEnv const childFiles = readdirSync(resolve(dirname(realPath ?? _path), pathName), { withFileTypes: false, recursive: true }) + .map(file => typeof file === 'string' ? file.split(/[/\\]/).join('/') : file) + const groupedFiles = childFiles.reduce((prev, curr) => { if (typeof curr !== 'string') return prev