Skip to content

Commit

Permalink
fix(taroize): 当 import 的 wxml 有多个根节点时转换失败,#1463
Browse files Browse the repository at this point in the history
  • Loading branch information
yuche committed Dec 12, 2018
1 parent 0fd43bd commit fcfc9a6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/taroize/src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,14 @@ export function parseModule (jsx: NodePath<t.JSXElement>, 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) {
//
}
Expand Down

0 comments on commit fcfc9a6

Please sign in to comment.