Skip to content

Commit

Permalink
fix: runtime compilation marker should be applied in exposed compile …
Browse files Browse the repository at this point in the history
…function
  • Loading branch information
yyx990803 committed Jul 28, 2020
1 parent a5e55e2 commit b3b65b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 0 additions & 2 deletions packages/runtime-core/src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions packages/vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit b3b65b4

Please sign in to comment.