diff --git a/packages/runtime-core/__tests__/rendererFragment.spec.ts b/packages/runtime-core/__tests__/rendererFragment.spec.ts
index a8299ef93df..5f1e869366f 100644
--- a/packages/runtime-core/__tests__/rendererFragment.spec.ts
+++ b/packages/runtime-core/__tests__/rendererFragment.spec.ts
@@ -351,4 +351,16 @@ describe('renderer: fragment', () => {
render(renderFn(['two', 'one']), root)
expect(serializeInner(root)).toBe(`text
two
textone
`)
})
+
+ // #10007
+ test('empty fragment', () => {
+ const root = nodeOps.createElement('div')
+
+ const renderFn = () => {
+ return openBlock(true), createBlock(Fragment, null)
+ }
+
+ render(renderFn(), root)
+ expect(serializeInner(root)).toBe('')
+ })
})
diff --git a/packages/runtime-core/src/renderer.ts b/packages/runtime-core/src/renderer.ts
index cb141d216ff..c7dfbf45dd2 100644
--- a/packages/runtime-core/src/renderer.ts
+++ b/packages/runtime-core/src/renderer.ts
@@ -1086,7 +1086,11 @@ function baseCreateRenderer(
// since they are either generated by the compiler, or implicitly created
// from arrays.
mountChildren(
- n2.children as VNodeArrayChildren,
+ // #10007
+ // such fragment like `<>>` will be compiled into
+ // a fragment which doesn't have a children.
+ // In this case fallback to an empty array
+ (n2.children || []) as VNodeArrayChildren,
container,
fragmentEndAnchor,
parentComponent,