Skip to content

Commit 8dbad83

Browse files
committed
fix(compat): fix v3 compiled fn detection in production
1 parent 68365b9 commit 8dbad83

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/runtime-core/src/compat/renderFn.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ import {
3939
} from './compatConfig'
4040
import { compatModelEventPrefix } from './componentVModel'
4141

42-
const v3CompiledRenderFnRE = /^(?:function \w*)?\(_ctx, _cache/
43-
4442
export function convertLegacyRenderFn(instance: ComponentInternalInstance) {
4543
const Component = instance.type as ComponentOptions
4644
const render = Component.render as InternalRenderFunction | undefined
@@ -50,8 +48,10 @@ export function convertLegacyRenderFn(instance: ComponentInternalInstance) {
5048
return
5149
}
5250

53-
if (v3CompiledRenderFnRE.test(render.toString())) {
54-
// v3 pre-compiled function
51+
if (render.length >= 2) {
52+
// v3 pre-compiled function, since v2 render functions never need more than
53+
// 2 arguments, and v2 functional render functions would have already been
54+
// normalized into v3 functional components
5555
render._compatChecked = true
5656
return
5757
}

0 commit comments

Comments
 (0)