fix(compiler-core): avoid generating useless createVNode helper (#2938)

close #2739
This commit is contained in:
HcySunYang
2021-03-26 05:01:50 +08:00
committed by GitHub
parent 2451dd8ae6
commit 7715c49af9
17 changed files with 117 additions and 77 deletions

View File

@@ -14,7 +14,7 @@ import {
import { TransformContext } from '../transform'
import { PatchFlags, isString, isSymbol } from '@vue/shared'
import { isSlotOutlet } from '../utils'
import { CREATE_VNODE } from '../runtimeHelpers'
import { CREATE_BLOCK, CREATE_VNODE, OPEN_BLOCK } from '../runtimeHelpers'
export function hoistStatic(root: RootNode, context: TransformContext) {
walk(
@@ -212,6 +212,8 @@ export function getConstantType(
// static then they don't need to be blocks since there will be no
// nested updates.
if (codegenNode.isBlock) {
context.removeHelper(OPEN_BLOCK)
context.removeHelper(CREATE_BLOCK)
codegenNode.isBlock = false
context.helper(CREATE_VNODE)
}