From 8b39619822040552468529bb6a2b3b1a82ca6d9b Mon Sep 17 00:00:00 2001 From: Jinbao1001 Date: Tue, 10 Sep 2024 13:45:33 +0800 Subject: [PATCH 1/2] fix: import specifier --- src/loaders/markdown/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/loaders/markdown/index.ts b/src/loaders/markdown/index.ts index 0f793495a..ee1b7fd42 100644 --- a/src/loaders/markdown/index.ts +++ b/src/loaders/markdown/index.ts @@ -150,7 +150,7 @@ function emitDemo( const entryFileName = Object.keys(demo.asset.dependencies)[0]; demoDepsMap[demo.id] ??= {}; Object.keys(demo.resolveMap).forEach((key, index) => { - const specifier = `${demo.id.replace(/-/g, '_')}_deps_${index}`; + const specifier = `${demo.id.replace(/[^\w\d]/g, '_')}_deps_${index}`; if (key !== entryFileName) { const normalizedKey = isRelativePath(key) ? winPath(demo.resolveMap[key]) From ed511070850c038fa10e58be1cb7c553d367c486 Mon Sep 17 00:00:00 2001 From: Jinbao1001 Date: Fri, 13 Sep 2024 10:50:13 +0800 Subject: [PATCH 2/2] fix: winpath --- src/loaders/post-raw/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/loaders/post-raw/index.ts b/src/loaders/post-raw/index.ts index 24750fd32..194b537c7 100644 --- a/src/loaders/post-raw/index.ts +++ b/src/loaders/post-raw/index.ts @@ -1,9 +1,10 @@ +import { winPath } from '@umijs/utils'; /** * loader for mako dumi-raw watch-parent */ export default function postRawLoader(this: any, raw: string) { return ` - import '${this.resourcePath}?watch=parent'; + import '${winPath(this.resourcePath)}?watch=parent'; ${raw}; `; }