]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore(compiler-core): define `child` if necessary. (#2033)
authoredison <daiwei521@126.com>
Tue, 15 Sep 2020 00:56:53 +0000 (08:56 +0800)
committerGitHub <noreply@github.com>
Tue, 15 Sep 2020 00:56:53 +0000 (20:56 -0400)
packages/compiler-core/src/transform.ts

index 4495d498094a513860ac81666f27fe191b03354f..4650c3685578d81c15be22355ef84472042dbd62 100644 (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