From 5eb8d385dae892f9428b16815dc9014146c7cb96 Mon Sep 17 00:00:00 2001 From: Zhenyu Pan Date: Wed, 27 Jul 2022 18:43:12 +0800 Subject: [PATCH] Fix previewer bug when has no entry component related issue: https://gitee.com/openharmony/developtools_ace-ets2bundle/issues/I5J8OK Signed-off-by: Zhenyu Pan --- compiler/src/process_ui_syntax.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/src/process_ui_syntax.ts b/compiler/src/process_ui_syntax.ts index 0cbd33e..5edf1a2 100644 --- a/compiler/src/process_ui_syntax.ts +++ b/compiler/src/process_ui_syntax.ts @@ -484,9 +484,10 @@ function createEntryNode(node: ts.SourceFile, context: ts.TransformationContext) return node; } } else { - const entryNode: ts.ExpressionStatement = - createEntryFunction(componentCollection.entryComponent, context); - return context.factory.updateSourceFile(node, [...node.statements, entryNode]); + const entryNode: ts.ExpressionStatement = + createEntryFunction(componentCollection.entryComponent || + Array.from(componentCollection.previewComponent)[0], context); + return context.factory.updateSourceFile(node, [...node.statements, entryNode]); } }