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).
This commit is contained in:
Cédric Exbrayat 2020-03-11 21:44:14 +01:00 committed by GitHub
parent 206640a2d8
commit 28a9beed16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -209,8 +209,10 @@ export function createVNode(
patchFlag: number = 0,
dynamicProps: string[] | null = null
): VNode {
if (__DEV__ && !type) {
if (!type) {
if (__DEV__) {
warn(`Invalid vnode type when creating vnode: ${type}.`)
}
type = Comment
}