fix: runtime compilation marker should be applied in exposed compile function

This commit is contained in:
Evan You 2020-07-28 11:11:26 -04:00
parent a5e55e28f1
commit b3b65b4058
2 changed files with 5 additions and 2 deletions

View 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

View 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)
}