From: Cédric Exbrayat Date: Wed, 11 Mar 2020 20:44:14 +0000 (+0100) Subject: fix(runtime-core): always set invalid vnode type (#820) X-Git-Tag: v3.0.0-alpha.9~36 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=28a9beed1624de9812e0f4ce9b63f7f3ed2c6db8;p=thirdparty%2Fvuejs%2Fcore.git fix(runtime-core): always set invalid vnode type (#820) 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). --- diff --git a/packages/runtime-core/src/vnode.ts b/packages/runtime-core/src/vnode.ts index 4608949119..e122091145 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 }