From 6302ec6ab35f5c9f6fd0a43a4e87fcc8fba146c4 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Tue, 10 Sep 2024 11:32:52 +0800 Subject: [PATCH] Fix(compiler): Fix multi-level dependency path compilation error BUG Close #6 --- src/components/Playground/compiler.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/Playground/compiler.ts b/src/components/Playground/compiler.ts index 3502f8c..6d7a5a7 100644 --- a/src/components/Playground/compiler.ts +++ b/src/components/Playground/compiler.ts @@ -135,7 +135,12 @@ class Compiler { } } - const path = importMap.imports[args.path] + let path = importMap.imports[args.path] + let tempPath = args.path + while (!path && tempPath.includes('/')) { + tempPath = tempPath.substring(0, tempPath.lastIndexOf('/')) + path = args.path.replace(tempPath, importMap.imports[tempPath]) + } if (!path) { throw Error(`Import '${args.path}' not found in Import Map`)