From: Evan You Date: Tue, 28 Jul 2020 15:11:26 +0000 (-0400) Subject: fix: runtime compilation marker should be applied in exposed compile function X-Git-Tag: v3.0.0-rc.5~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3b65b40582d7fbdc776bfe8a1542b80aebe0aac;p=thirdparty%2Fvuejs%2Fcore.git fix: runtime compilation marker should be applied in exposed compile function --- diff --git a/packages/runtime-core/src/component.ts b/packages/runtime-core/src/component.ts index 58e1725e8e..c0ea6ab3f3 100644 --- a/packages/runtime-core/src/component.ts +++ b/packages/runtime-core/src/component.ts @@ -601,8 +601,6 @@ function finishComponentSetup( if (__DEV__) { endMeasure(instance, `compile`) } - // mark the function as runtime compiled - ;(Component.render as InternalRenderFunction)._rc = true } instance.render = (Component.render || NOOP) as InternalRenderFunction diff --git a/packages/vue/src/index.ts b/packages/vue/src/index.ts index a9ccf894ef..c810d03eb9 100644 --- a/packages/vue/src/index.ts +++ b/packages/vue/src/index.ts @@ -5,6 +5,7 @@ import { compile, CompilerOptions, CompilerError } from '@vue/compiler-dom' import { registerRuntimeCompiler, RenderFunction, warn } from '@vue/runtime-dom' import * as runtimeDom from '@vue/runtime-dom' import { isString, NOOP, generateCodeFrame, extend } from '@vue/shared' +import { InternalRenderFunction } from 'packages/runtime-core/src/component' __DEV__ && initDev() @@ -74,6 +75,10 @@ function compileToFunction( const render = (__GLOBAL__ ? new Function(code)() : new Function('Vue', code)(runtimeDom)) as RenderFunction + + // mark the function as runtime compiled + ;(render as InternalRenderFunction)._rc = true + return (compileCache[key] = render) }