From 3ef84cec8e92c2b8b9d13d79dcaad31454a9e7b9 Mon Sep 17 00:00:00 2001 From: cexbrayat Date: Wed, 11 Mar 2020 16:28:19 +0100 Subject: [PATCH] fix(runtime-core): always set invalid vnode type Currently, when a component used is not properly registered, we have a warning and the vnode type is set to a Comment type in DEV mode. But in prod mode, we have no default value, making such an application broken and throw a strange error (`can not read _isSuspense of undefined`). This commit avoids such an error in prod mode (as it is currently the case in Vue 2.x). --- packages/runtime-core/src/vnode.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/runtime-core/src/vnode.ts b/packages/runtime-core/src/vnode.ts index 46089491191..e122091145d 100644 --- a/packages/runtime-core/src/vnode.ts +++ b/packages/runtime-core/src/vnode.ts @@ -209,8 +209,10 @@ export function createVNode( patchFlag: number = 0, dynamicProps: string[] | null = null ): VNode { - if (__DEV__ && !type) { - warn(`Invalid vnode type when creating vnode: ${type}.`) + if (!type) { + if (__DEV__) { + warn(`Invalid vnode type when creating vnode: ${type}.`) + } type = Comment }