Fix previewer bug when has no entry component

related issue: https://gitee.com/openharmony/developtools_ace-ets2bundle/issues/I5J8OK

Signed-off-by: Zhenyu Pan <panzhenyu1@huawei.com>
This commit is contained in:
Zhenyu Pan
2022-07-27 18:43:12 +08:00
parent e5755a078f
commit 5eb8d385da
+4 -3
View File
@@ -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]);
}
}