From a41171854f4962637a15dbef347ea0038f59c8d7 Mon Sep 17 00:00:00 2001 From: houhaoyu Date: Wed, 3 Aug 2022 11:14:37 +0800 Subject: [PATCH] houhaoyu@huawei.com fix special import Signed-off-by: houhaoyu Change-Id: I874269c5b99b3d26d75980394ca77ee20c87ef83 --- compiler/src/process_import.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/compiler/src/process_import.ts b/compiler/src/process_import.ts index a3bdb09..7f4a930 100644 --- a/compiler/src/process_import.ts +++ b/compiler/src/process_import.ts @@ -272,11 +272,17 @@ function collectSpecialFunctionNode(node: ts.FunctionDeclaration, asNameFromPare let componentName: string; if (asNameFromParent.has(name)) { collection.add(asNameFromParent.get(name)); - } else if (node.modifiers && node.modifiers.length >= 2 && node.modifiers[0] && - node.modifiers[0].kind === ts.SyntaxKind.ExportKeyword && node.modifiers[1] && - node.modifiers[1].kind === ts.SyntaxKind.DefaultKeyword && defaultNameFromParent && - asNameFromParent.has(defaultNameFromParent)) { - collection.add(asNameFromParent.get(defaultNameFromParent)); + } else if (node.modifiers && node.modifiers.length >= 1 && node.modifiers[0] && + node.modifiers[0].kind === ts.SyntaxKind.ExportKeyword) { + if (node.modifiers.length == 1) { + collection.add(name); + } else if (node.modifiers.length >= 2 && node.modifiers[1] && node.modifiers[1].kind === + ts.SyntaxKind.DefaultKeyword) { + collection.add(CUSTOM_COMPONENT_DEFAULT); + if (defaultNameFromParent && asNameFromParent.has(defaultNameFromParent)) { + collection.add(asNameFromParent.get(defaultNameFromParent)); + } + } } else if (defaultCollection.has(name)) { collection.add(CUSTOM_COMPONENT_DEFAULT); } else if (asExportCollection.has(name)) {