Skip to content

Commit 28a9bee

Browse files
authored
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).
1 parent 206640a commit 28a9bee

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/runtime-core/src/vnode.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,10 @@ export function createVNode(
209209
patchFlag: number = 0,
210210
dynamicProps: string[] | null = null
211211
): VNode {
212-
if (__DEV__ && !type) {
213-
warn(`Invalid vnode type when creating vnode: ${type}.`)
212+
if (!type) {
213+
if (__DEV__) {
214+
warn(`Invalid vnode type when creating vnode: ${type}.`)
215+
}
214216
type = Comment
215217
}
216218

0 commit comments

Comments
 (0)