From fcfc9a67cb8496d63dcdbeaf4318997b8f5127e4 Mon Sep 17 00:00:00 2001 From: yuche Date: Wed, 12 Dec 2018 10:28:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(taroize):=20=E5=BD=93=20import=20=E7=9A=84?= =?UTF-8?q?=20wxml=20=E6=9C=89=E5=A4=9A=E4=B8=AA=E6=A0=B9=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E6=97=B6=E8=BD=AC=E6=8D=A2=E5=A4=B1=E8=B4=A5=EF=BC=8C?= =?UTF-8?q?#1463?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taroize/src/template.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/taroize/src/template.ts b/packages/taroize/src/template.ts index cfd399b17dbd..99960fd73006 100644 --- a/packages/taroize/src/template.ts +++ b/packages/taroize/src/template.ts @@ -182,9 +182,14 @@ export function parseModule (jsx: NodePath, dirPath: string, type: } else { const { wxml } = parseWXML(dirPath, getWXMLsource(dirPath, srcValue, type)) const block = buildBlockElement() - block.children = [t.jSXExpressionContainer(t.jSXEmptyExpression())] try { - jsx.replaceWith(wxml || block) + if (wxml) { + block.children = [wxml as any] + jsx.replaceWith(wxml) + } else { + block.children = [t.jSXExpressionContainer(t.jSXEmptyExpression())] + jsx.replaceWith(block) + } } catch (error) { // }