]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix: runtime compilation marker should be applied in exposed compile function
authorEvan You <yyx990803@gmail.com>
Tue, 28 Jul 2020 15:11:26 +0000 (11:11 -0400)
committerEvan You <yyx990803@gmail.com>
Tue, 28 Jul 2020 15:11:26 +0000 (11:11 -0400)
packages/runtime-core/src/component.ts
packages/vue/src/index.ts

index 58e1725e8e9a251b9c9605aae8f8414c92e18c53..c0ea6ab3f3dc3c34a8d0107c1d7b43c7408a1b2c 100644 (file)
@@ -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
index a9ccf894ef9f398a9f1468209c5d35848d0774fe..c810d03eb920430ea3400bebbf853759b83bca02 100644 (file)
@@ -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)
 }