chore(compiler-core): define child if necessary. (#2033)

This commit is contained in:
edison 2020-09-15 08:56:53 +08:00 committed by GitHub
parent 09a939d37c
commit b29bc0d694
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -287,8 +287,8 @@ export function transform(root: RootNode, options: TransformOptions) {
function createRootCodegen(root: RootNode, context: TransformContext) {
const { helper } = context
const { children } = root
const child = children[0]
if (children.length === 1) {
const child = children[0]
// if the single child is an element, turn it into a block.
if (isSingleElementRoot(root, child) && child.codegenNode) {
// single element root is never hoisted so codegenNode will never be